JimmyTube
JimmyTube

Reputation: 29

WatchOS 3 : Why does WCSession never activate on iPhone?

I am creating a simple app that involves communication between an Apple Watch and an iPhone.

Currently using an iPhone 6s (10.3.2) with WatchOS 3.2.2

I cannot get the two to communicate, and I believe my poblem is that WCSession does not activate on the iPhone.

When the WatchOS code runs, the console prints out "activationDidCompleteWithState" as expected, indicating the WCSession has been activated(see code below).

However, on the iOS side the "activationDidCompleteWithState" method never prints to the console. If I try to send messages from the watch to the phone, they timeout and I get the following error:

[WC] -[WCSession onqueue_handleMessageCompletionWithError:withMessageID:] 109FE5D2-6218-4D67-AFD7-E72FA7E4A22E due to WCErrorCodeTransferTimedOut->IDSErrorTypeTimedOut->IDSResponseTimedOut

I believe the WCSession is just never activated on the phone. Has ayone seen this problem? I am going crazy with this...

I had previously built this with WatchOS 2, and it worked fine. Somehow, the update to WatchOS 3 has done me in. Any help would be appreciated.

iOS code in AppDelegate.m:

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    if ([WCSession isSupported])
    {
        WCSession* session = [WCSession defaultSession];
        session.delegate = self;
        [session activateSession];
    }

    return YES;
}
- (void)session:(WCSession *)session activationDidCompleteWithState:(WCSessionActivationState)activationState
          error:(NSError *)error
{
    NSLog(@"PHONE - activationDidCompleteWithState");
}

WatchOS code in ExtensionDelegate.m:

@implementation ExtensionDelegate
- (void)applicationDidFinishLaunching
{
    if ([WCSession isSupported])
    {
        WCSession* session = [WCSession defaultSession];
        session.delegate = self;
        [session activateSession];
    }
}
- (void)session:(WCSession *)session activationDidCompleteWithState:(WCSessionActivationState)activationState
          error:(NSError *)error
{
    NSLog(@"activationDidCompleteWithState");
}

Upvotes: 1

Views: 846

Answers (1)

JimmyTube
JimmyTube

Reputation: 29

Ok, I figured this out.

I power cycled the iPhone which got WCSession working on the phone. Had to unpair watch, then re-pair it.

It's working now. Total nonsense...

Upvotes: 1

Related Questions