I am new in WatchKit and I am working on one of my app, but I am facing one problem regarding connection with Apple watch.
my source code is below:
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ //create a session using wcsession
if ([WCSession isSupported]) {
[[WCSession defaultSession] setDelegate:self];
[[WCSession defaultSession] activateSession];
}
return YES;
}
Send message action in my viewcontroller:
[[WCSession defaultSession] sendMessage:dict replyHandler:^(NSDictionary *replyHandler)
{
NSLog(@"Replay %@",replyHandler);
}
errorHandler:^(NSError *error) {
NSLog(@"Error %@",error);
}];
Also I activate the wcsession at watch side in complication controller
]if ([WCSession isSupported]) {
[[WCSession defaultSession] setDelegate:self];
[[WCSession defaultSession] activateSession];
}
and
-(void)session:(nonnull WCSession *)session
didReceiveMessage:(nonnull NSDictionary<NSString *,id> *)message
replyHandler:(nonnull void (^)(NSDictionary<NSString *,id> * __nonnull))replyHandler {
[extensionDelgate InsertIntoTideMaster:message];
[self requestedUpdateDidBegin];
dispatch_async(dispatch_get_main_queue(), ^{
});
}
This works first time when I am launching the app, but after that I got 7007 code error ... can you tell me what is missing here?
Thanks in advance.