SendMessage Complication Controller Wake iOS App

So, I am trying to use the oppertunity when my Watchkit complication calls requestUpdateDidBegin() to use sendMessage() to wake my iOS app and cause it to calculate complication data and use transferCurrentComplicationUserInfo() to update the complication. I call sendMessage() from the extension delegate. I am experiencing mixed luck with this actually reaching the iOS app. Even with my iPhone next to the watch the performance varies. One time I built my app to my phone and it successfully delivered over 30 updates to my complication through sendMessage() andtransferCurrentComplicationUserInfo(), over the course of two days. I then uninstalled the app from the watch using the watch app, and then reinstalled it from the watch app (So absolutly no code or build changes) and it stopped working! I suspect there is clearly some bugs and unreliability with calling sendMessage(). Is anyone else finding this, is there any workarounds? How can I wake my iPhone app from when the complication controller calls requestUpdateDidBegin()?

Accepted Reply

no, unfortunately that is not possible. It might be worthwhile writing an enchancement request bug report explaining why you think this would be a worthwhile addition to the APIs. What do you mean by "more efficient"? I don't think power consumption would be a valid reason though as the cumulative power usage would be higher when involving waking the phone and launching the iOS app in the background.

Replies

I don't believe there is any guarantee you can wake the iPhone from the watch. If you need to update with data from the phone, you are better to schedule the updates on the iPhone app and then push the updated data from the phone. You'll probably need to enable a background mode on the iPhone app for this to work (location services, background data transfer, depending on your data type.)

But theres no way to wake the phone from background for what I want other than fetch, and fetch is completely unreliable. I struggle to understand why I can't wake my app reliable from my complication controller, but I can wake it reliably from my interface or glance controller.

You can schedule local notifications on the phone, these will wake up your app. You can also schedule delays (as long as you have a background mode enabled.)

you can only use sendMessage when the reachable property is true/YES. In most cases this will not be true when your WatchKit extension is running for a complication update. The WWDC talk on WatchConnectivity covers reachability in quite a lot of detail.

i understand that, so is there any other way to use the scheduled update call to communicate with the phone. It would be far more efficient for me to get the iPhone to do the work than on the watch

no, unfortunately that is not possible. It might be worthwhile writing an enchancement request bug report explaining why you think this would be a worthwhile addition to the APIs. What do you mean by "more efficient"? I don't think power consumption would be a valid reason though as the cumulative power usage would be higher when involving waking the phone and launching the iOS app in the background.

Cheers for the help Viking. I only meant for saving power on the watch. A sendMessage WatchConnectivity function would use less watch battery than an NSUrL request I guess