WCSession activateSession from Today Extension

Hello,


Our app includes a Today Extension that shows common data to our Watch app. When the Today widget is refreshed, we want to use WatchConnectivity to push an update over to the watch.


In the today extension, we activate in awakeFromNib:


if ([WCSession isSupported])
{
        WCSession *wcSession = [WCSession defaultSession];
        wcSession.delegate = self;
        [wcSession activateSession];
      
#ifdef _DEBUG
        NSLog(@"%@ WCSession active",self.class);
#endif
}


logs show this occurring


Then a bit later, when the user initiates an action on the widget that refreshes content, we find the activation state says Not Activated


wcSession.activationState == WCSessionActivationStateNotActivated


We don't have any issues with this from the app itself, just the today extension.


Any tips or guidance on how to diagnose? Anyone else trying this with success?


Chris @ Vertifi

Accepted Reply

WCSession is not available from iOS extensions, only from the main iOS app.

Replies

additional note, attempting to call activateSession again generates these log messages


Jul 12 07:41:29 Vertifi-iPhone6 My Today Extension(WatchConnectivity)[4443] <Notice>: __28-[WCSession activateSession]_block_invoke
Jul 12 07:41:29 Vertifi-iPhone6 My Today Extension(WatchConnectivity)[4443] <Error>: already in progress or activated

WCSession is not available from iOS extensions, only from the main iOS app.

Thanks ... as today extensions can fetch and update the content shared with the app (via shared containers and keychains), it would be nice if those content updates could be queued for delivery to the watch via WatchConnectivity. As it is now, things seem "broken". Enhancement request!