我正在通过使用openParenApplication和handleWatchKitExtensionRequest从我的watchKit应用程序发出Web API请求,但我总是得到致命错误:在openParenApplication中打开replyInfo的可选值时意外地发现了nil。(我认为当app(handleWatchKitExtensionRequest) )没有正确调用服务器,所以replyInfo是nil ...)
handleWatchKitExtensionRequest中的代码
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_async(queue, ^(void) {
// API Request here
dispatch_async(dispatch_get_main_queue(), ^{
//return the response
NSDictionary *replyDict = @{@"apiResponse": @"ResponseData"};
reply(replyDict);
});
});
我该如何解决这个问题?