iPhoneの親アプリを開く方法を知る必要があります。バージョン 1.0.1の時計があり、親アプリには8.4 iOSがあります。
これは私のコードですAppDelegate
__block UIBackgroundTaskIdentifier bogusWorkaroundTask;
bogusWorkaroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:bogusWorkaroundTask];
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] endBackgroundTask:bogusWorkaroundTask];
});
// --------------------
そして、これは私が情報に返信する方法です:
if ([[userInfo objectForKey:@"request"] isEqualToString:@"program"]) {
__block UIBackgroundTaskIdentifier realBackgroundTask;
realBackgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
reply(nil);
[[UIApplication sharedApplication] endBackgroundTask:realBackgroundTask];
}];
// Kick off a network request, heavy processing work, etc.
// Return any data you need to, obviously.
[WatchRequestsHandler handleCurrentProgramRequestWithReply:reply];
[[UIApplication sharedApplication] endBackgroundTask:realBackgroundTask];
NSLog(@"Reply :: %@ ", reply);
} else if([[userInfo objectForKey:@"request"] isEqualToString:@"programs"]){
__block UIBackgroundTaskIdentifier realBackgroundTask;
realBackgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
reply(nil);
[[UIApplication sharedApplication] endBackgroundTask:realBackgroundTask];
}];
// Kick off a network request, heavy processing work, etc.
// Return any data you need to, obviously.
[WatchRequestsHandler handleProgramsRequestWithReply:reply];
[[UIApplication sharedApplication] endBackgroundTask:realBackgroundTask];
NSLog(@"Reply :: %@ ", reply);
}
しかし、親アプリが開きません。
私の間違いは何ですか!助けてください