Apple Watch openparentapplication:回复:收到错误域=FBSOpenApplicationErrorDomain 代码=5

Apple Watch openparentapplication: reply: receives Error Domain=FBSOpenApplicationErrorDomain Code=5

我为 Apple Watch 创建了一个较小的项目,以便与其运行的父应用程序进行通信。

所以我在我现有的 iOS 项目中创建了一个 Watch 工具包扩展,但是当它从 Watch 端调用 openparent 应用程序时,它会收到回复块

错误:错误域=FBSOpenApplicationErrorDomain代码=5“操作无法完成。(FBSOpenApplicationErrorDomain错误5。)”。

这个错误是什么意思?有什么目标问题吗?请找到以下代码:

手表套件端:

- (IBAction)satusButtonClicked {

    NSLog(@"StausButtonClicked");
    NSDictionary *senddict=[[NSDictionary alloc] initWithObjects:@[@"5",@"Two",@"Three"] forKeys:@[@"1",@"2",@"3"]];
    [InterfaceController openParentApplication:senddict reply:^(NSDictionary *replyInfo, NSError *error) {
        NSLog(@"ReplyReceived : %lu",(unsigned long)[replyInfo count]);
        NSLog(@"Reply Info: %@", replyInfo);
        NSLog(@"Error: %@", error);
    }];

}

iOS 边 :

-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
    NSLog(@"Watckit call received");
    reply(@{@"Score": @"234"});
In the info.plist, I had "Application Does Not Run in Background" set to YES. This caused the problem. Changing that setting to NO fixed it.

从这里回答: