Search code examples
iosobjective-ciphonewatchkitapple-watch

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


I have created a smaller project for Apple watch to communicate with it’s parent application it’s worked.

So I have created a Watch kit extension in my existing iOS project but when from Watch side it call openparent application in reply block it receives

Error: Error Domain=FBSOpenApplicationErrorDomain Code=5 "The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 5.)”.

What does this error means? Is there any target issue? Please find the code below:

Watch kit side :

- (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 side :

-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
    NSLog(@"Watckit call received");
    reply(@{@"Score": @"234"});

Solution

  • 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.
    

    Answered from here: iOS Error: FBSOpenApplicationErrorDomain error 5. What does this mean?