I am running WatchOS 2.0 on Version 7.0 beta 5. I am running an iOS with iWatch App.
I setup the Targets as shown.
I had my iOS's ViewController and WatchKitExtension's Interface Controller both activated WCSession and set as delegate.
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
NSLog(@"iOS App WCSession is supported");
}
Then I tried to send userInfo from Watch to iOS :
NSDictionary *userInfo = [[NSDictionary alloc]initWithObjectsAndKeys:@"testingURL", @"outputURL", nil];
[[WCSession defaultSession] transferUserInfo:userInfo];
But my ViewController's delegate method never get called:
- (void)session:(WCSession *)session didReceiveUserInfo:(NSDictionary<NSString *,id> *)userInfo{
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Received userInfo Transferr");
NSLog(@"%@", userInfo);
[self.label setText:@"Received"];
});
}
I was running the Watch App and iOS together from Simulator by pressing Run here from this scheme:
Could anyone please tell me what did I do wrong?
from WatchOS 2.0: WCSessionDelegate not get called (in Simulator)
No comments:
Post a Comment