ios中的openParentApplication调用不会打开我的父应用程序

时间:2015-08-26 00:39:55

标签: objective-c watchkit appdelegate apple-watch apple-watch-complication

我需要知道如何打开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);
    } 

但是我的父应用程序没有打开。

我的错误是什么!请帮忙

0 个答案:

没有答案