قالب وردپرس درنا توس
Home / IOS Development / IOS – WatchOS 2.0: WCSessionDelegate Not Called (in Simulator)

IOS – WatchOS 2.0: WCSessionDelegate Not Called (in Simulator)



I'm running WatchOS 2.0 on version 7.0 beta 5.
I am running an iOS with iWatch App.

I configure the goals as shown.

 enter picture description here

I had iOS ViewController and WatchKitExtension's Interface Controller both enabled WCSession and set as delegate.

  if ([WCSession isSupported]) {
WCSession * session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
NSLog (@ "iOS App WCSession supported");
}

Then I tried to send userInfo from Watch to iOS:

  NSDictionary * userInfo = [[NSDictionary alloc] initWithObjectsAndKeys: @ "testingURL", @ "outputURL", zero);
[[WCSession defaultSession] transferUserInfo: userInfo];

But my ViewController's delegated method is never called:

  - (void) session: (WCSession *) increased didReceiveUserInfo: (NSDictionary  *) user info {

dispatch_async (dispatch_get_main_queue (), ^ {
NSLog (@ "Received User Info Transferr");
NSLog (@ "% @", userInfo);
[self.label setText:@"Received"];
});
}

I ran Watch App and iOS together from Simulator by pressing Run here from this scheme:

 Enter picture description here

Can anyone talk to me what did I do wrong? [[1

9659013]

Source link