我已经为Apple Watch创建了一个更小的项目,用于与其父应用程序进行通信,它可以正常工作。
因此,我在现有的iOS项目中创建了一个Watch kit扩展,但是当从Watch侧调用openparent应用程序时,在回复块中它会收到以下错误消息:
“Error: Error Domain=FBSOpenApplicationErrorDomain Code=5 "The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 5.)”。
这个错误是什么意思?是否存在任何目标问题?请查看下面的代码:
Watch kit侧:
- (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"});