gpt4 book ai didi

ios - "The UIApplicationDelegate in the iPhone App never called reply() in -[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]"

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:41:12 27 4
gpt4 key购买 nike

好的,我正在制作这个 Apple Watch 应用程序,在我的 Watch 应用程序中,我有一个按钮。当您触摸按钮时,它会执行以下操作:

[WKInterfaceController openParentApplication:[NSDictionary dictionary] reply:^(NSDictionary *replyInfo, NSError *error) {
if(error) {
NSLog(@"%@",error);
}
}];

在我的 App 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com