0

i'm now develop a watch app that will be running together with iOS companion app. So it is important to know whether the app is running and linked or not.

For now, i can know the state of the watch app through iOS app, but i could not know the state of iOS app from watch app. Example if user kill the iOS app, i cannot detect if the companion app is running or not.

i have tried with following code;

func sessionReachabilityDidChange(_ session: WCSession) {
    print("session reachbility did change \(session)")
}

but no luck, this function is not called when i quit the iOS companion app. And i have read through the apple document but no luck. Does anyone know how to do that?

EDITED After i try with WCSessionActivationState. When my watch app is running, but iPhone companion app is not running, but the return WCSessionActivationState is activated. Is it a bugs or something?

wes. i
  • 627
  • 9
  • 26
  • Is the goal to enable certain functionality only when your app is running in the foreground on both devices? – ccjensen Nov 02 '16 at 07:30
  • Yup, that is what I'm doing – wes. i Nov 02 '16 at 08:16
  • @S.Wei I am facing this currently in a project where I need to notify my apple watch app from companion app if it was force quitted. Did you ever get it resolved? If so, could you please guide me through? – Rohan Apr 05 '18 at 19:20
  • Hi @rohan sorry for late reply, i just do it in the way when my watch app is launch, i send something to companion app, if i don't get the reply, means the companion app is not active then i would notify user through watch interface, do you need any further details? – wes. i Apr 06 '18 at 16:24

0 Answers0