WCSession sendMessageData / no repeat after watch waking up

Hi together,


my watch app requests the iPhone continously for generating a geo specific UIImage and transfers it back by "sendMessageData". To avoiding multiple parallel requests I tried two schemes:


1. sendMessageData/didReceiveMessageData on both sides: In my extension I start a request when session state changed to reachable. Then I receive this request on the iPhone via "didReceiveMessageData". I generate the image and send it back to the watch via "sendMessageData". On the extension I have also a "didReceiveMessageData" implemented. After processing the UIImage I start my next request via "sendMessageData".


2. using replyHandler: In my extension I start a request when session state changed to reachable. In the "sendMessageData" on watch side I have implemented a replyHandler which processes the reply from the iPhone and starts the next request. On the iPhone I have only implemented "didReceiveMessageData" where I analyse the request, generates the UIImage and send it back as a replyHandler.


The problem is for both implementations the same:


When the watch goes in supsension mode (tilting hand -> display goes off) and I immediately tab on the watch, the request ends up in nirvana. In my analyzis it seems that the watch sends the request but didn't get any answer. However there is no error in the error handler on the "sendMessageData" on the watch.


But if I wait a few seconds before I tab the screen, the app comes back from suspension, sends the request and gets an answer.

Bye the way, on the simulator I don't have this crazy effect.


Any ideas how to solve that?


Walter

This sounds very odd. Please file a bug report with Apple, including a small sample project and report back here with the number and I'll make sure it gets to the right engineers promptly!

rdar://problem/22592138 (Open) explains why the request fails when you tap the watch immediately after suspension -- the extension suspends after the app and the extension isn't sent the message to resume when it is in the process of suspending. The Watch console logs show the following events:


process com.company.watchapp is now suspending

process com.company.watchapp is now running the foreground

process com.company.watchapp.extension is now suspending


This is very easy to reproduce with any 3rd party app by lowering your wrist and then quickly raising it. Apple's watch apps are unaffected because they don't have separate extensions.


There is another bug rdar://problem/23120733 (Open) where sendMessageData fails on the Watch within the first 1 or 2 seconds after the watch app resumes because the Watch app and extension resume before [WatchConnectivityDaemon listenerShouldAcceptNewConnection:] is called. To get detailed WatchConnectivity logging, sync your iPhone with iTunes and then look in


/Users/yourUsername/Library/Logs/CrashReporter/MobileDevice/iPhoneName/ProxiedDevice-yourWatchIdentifier/DiagnosticLogs/WatchConnectivity


Viking - please help these bugs get to the right engineers. Both of these issues hamper all 3rd party apps. Since Apple's Watch apps don't have extensions and the Workout app can run in the background, I don't think the Watch team realizes how these bugs around extension suspension impact user experience.

Same problem here. If I do a sendMessageData right after the app was started from a remote notification, the answer is not returned to the watch.


As we don't know when or if this will be fixed I will revert my app to Watch OS 1. Seems like the only solution 😟

I'm curious, have you checked the reachable property at the point you attempt sendMessageData?

Yes, it's reachable.

Thanks for the bug reports, EricSF. I can confirm that they have been routed to the right engineers and most, if not all, issues discussed here will have fixes in future releases.

WCSession sendMessageData / no repeat after watch waking up
 
 
Q