Apple Watch WCSession Broken With iPhones Restored From Backup

Hi All,


I've noticed that WCSession is not usable after restoring a new iOS device and wanted to see if anyone else has seen this issue? It seems pretty serious because of how common the triggering flow is -- essentially upgrading to a new iPhone. The bug seems to trigger in the below scenario. It may be specific to certain iOS/watchOS combinations but we've seen it in multiple devices.


1) A user installs an app on iPhone A. The app has a companion watch app that is also installed on the users watch.

2) The user successfully uses the watch app. This results in successful use of WCSession. e.g. -[WCSession sendMessage:replyHandler:errorHandler:] works as expected.

3) The user backsup iPhone A.

4) The user gets a new phone, iPhone B, and restores it using the backup from the previous step.


Expected behavior:

- The Apple Watch app can successfully communicate with the corresponding iPhone app.


Actual behavior:

-The Apple Watch cannot communicate with the corresponding iPhone app. In particular the following is observed:

- After calling [[WCSession defaultSession] activateSession] while the iPhone is in range, the session is never activated. The [WCSession defaultSession].activationState is always WCSessionActivationStateNotActivated.

- Calling `-[WCSession sendMessage:replyHandler:errorHandler:]` results in the following log message:

2018-10-05 14:45:17.000936-0700 WatchApp Extension[3663:27192829] [WC] -[WCSession _onqueue_notifyOfMessageError:messageID:withErrorHandler:]_block_invoke dropping as pairingIDs no longer match. pairingID (null), client pairingID: (null)


There are more details and logs in the radar (https://bugreport.apple.com/web/?problemID=45058964)