Overview:
- I am building a very simple Apple Watch and iPhone app
- I am running/debugging the apps using the watch and phone simulators in Xcode
- I am using WatchConnectivity to make them communicate
- I cannot activate a
WCSession
on either the watch or phone simulators although they are paired
In the Xcode Devices window, my watch simulator and phone simulator are paired. I am able to launch my watch app using the WatchKit App scheme (which also launches the phone simulator but doesn't open the mobile app). I then launch my mobile app by clicking on the app icon on the phone simulator.
Mobile app:
ViewController
implementsWCSessionDelegate
- WatchConnectivity session is activated in the
viewDidLoad
method
Watch app:
InterfaceController
implementsWCSessionDelegate
- WatchConnectivity session is activated in the
willActivate
method
When I run the WatchKit app, the following message is logged:
[WC] WCSession has not been activated
When I then open the mobile app by clicking on the app icon, I get the following messages:
[WC] WCSession has not been activated
Apple Watch is not paired
[WC] WCSession has not been activated
WatchKit app is not installed on the paired watch
(I added logging statements to display the result of checking isPaired
and isWatchAppInstalled
on the session in the mobile app)
My WCSession
activation code is the same in my mobile app and watch app:
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
// print debugging statements about paired watch, etc.
}
Does anyone know why WatchConnectivity doesn't detect the fact that the phone and watch simulators are paired? Why doesn't the WCSession
get activated?