iOS 错误:FBSOpenApplicationErrorDomain 错误 5. 这是什么意思? [英] iOS Error: FBSOpenApplicationErrorDomain error 5. What does this mean?

查看:24
本文介绍了iOS 错误:FBSOpenApplicationErrorDomain 错误 5. 这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了错误报告4 但没有看到 5.我把它理解为当我尝试使用openParentApplication:reply"请求时的控制台消息.日志中没有足够的信息来了解问题出在 iOS 代码、WK 代码还是模拟器中.我已经重新启动了 sim,并清理了项目.有什么想法吗?

I've seen reports for errors 4 but not for 5. I get this as a console message when I'm trying to use an "openParentApplication:reply" request. There isn't enough information in the log to know if the problem is in the iOS code, the WK code or the Simulator. I've restarted the sim, and cleaned the project. Any ideas?

WK 代码:

- (IBAction)sendRequest {

    NSDictionary *request = @{@"request":@"Request1"};

    [InterfaceController openParentApplication:request reply:^(NSDictionary *replyInfo, NSError *error) {

        if (error) {
            NSLog(@"%@", error);
        } else {

            [self.label1 setText:[replyInfo objectForKey:@"response1"]];
            [self.label2 setText:[replyInfo objectForKey:@"response2"]];
            [self.label3 setText:[replyInfo objectForKey:@"response3"]];
        }

    }];
}

iOS 代码:

- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply{

    NSLog(@"%s", __FUNCTION__);
    //([max intValue] - [min intValue]) + [min intValue]

    int randNum1 = arc4random_uniform(16);
    int randNum2 = arc4random_uniform(16);
    int randNum3 = arc4random_uniform(16);


    NSString *num1 = [NSString stringWithFormat:@"Test%d", randNum1]; 
    NSString *num2 = [NSString stringWithFormat:@"Test%d", randNum2];
    NSString *num3 = [NSString stringWithFormat:@"Test%d", randNum3]; 

    if ([[userInfo objectForKey:@"request"] isEqualToString:@"Request1"]) {

        NSLog(@"containing app received message from watch: Request1");


        NSDictionary *response = @{@"response1" : num1, @"response2" : num2, @"response3" : num3};
        reply(response);
    }

}

唯一的控制台日志是:

WatchKit Extension[48954:9523373] Error Domain=FBSOpenApplicationErrorDomain Code=5 "The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 5.)

推荐答案

我建议你尽量简化.我已经在这里回答了一个非常相似的问题a> 在 Swift 中.我会将逻辑简化为以下内容:

I would suggest you try to simplify. I have answered a very similar problem here that is in Swift. I would simplify the logic to the following:

WK 代码

- (IBAction)sendRequest {
    [InterfaceController openParentApplication:request reply:^(NSDictionary *replyInfo, NSError *error) {
        NSLog(@"Reply Info: %@", replyInfo);
        NSLog(@"Error: %@", error);
    }];
}

iOS 代码

- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply {
    NSDictionary *response = @{@"replyKey" : @"replyValue"};
    reply(response);
}

一旦你完成这项工作,然后开始一步一步地添加额外的解析.您还可以按照 这些 说明.你可能没有在 iOS 应用上调用回复块,你甚至不知道.

Once you have this working, then start adding the additional parsing one step at a time. You can also attach the debugger to the iOS app to step through the call by following these instructions. You may not be calling the reply block on the iOS app and you don't even know it.

这篇关于iOS 错误:FBSOpenApplicationErrorDomain 错误 5. 这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆