好的,我正在制作这个 Apple Watch 应用,在我的 Watch 应用中,我有一个按钮。当您触摸按钮时,它会执行以下操作:
[WKInterfaceController openParentApplication:[NSDictionary dictionary] reply:^(NSDictionary *replyInfo, NSError *error) {
if(error) {
NSLog(@"%@",error);
}
}];
在我的应用程序委托(delegate)文件中,我执行以下操作:
-(void) application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply {
//Code that is not importent and is confidential
reply([NSDictionary dictionary]);
}
但是,当我按下按钮时,我收到此错误:
Error Domain=com.apple.watchkit.errors Code=2 "The UIApplicationDelegate in the iPhone App never called reply() in -[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]" UserInfo=0x7fd2b9c35ae0 {NSLocalizedDescription=The UIApplicationDelegate in the iPhone App never called reply() in -[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]}
我正在调用 reply()
如上所示,但它没有看到这一点!另外,它忽略了我在那里的其他代码!
谁能解释一下为什么会发生这种情况?
最佳答案
来自文档:
replyInfo: A dictionary containing data to return to the WatchKit app. The contents of the dictionary must be serializable to a property list file. The contents of this dictionary are at your discretion and you may specify nil.
如果您没有发送有效的词典,您将不会收到回复。
关于ios - "The UIApplicationDelegate in the iPhone App never called reply() in -[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29220000/