WKInterfaceController子类
[WKInterfaceController openParentApplication:[NSDictionary dictionaryWithObject:@"red" forKey:@"color"] reply:^(NSDictionary *replyInfo,NSError *error) {NSLog(@"replyInfo %@",replyInfo);NSLog(@"Error: %@",error);}];
AppDelegate.m
- (voID)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(voID(^)(NSDictionary *replyInfo))reply{NSLog(@"appdelegate handleWatchKitExtensionRequest");NSLog(@"NSDictionary: %@",userInfo);NSLog(@"replyInfo: %@",replyInfo);}
我得到的错误是:
解决方法 您需要调用回复块,即使您返回零.以下将解决您的错误:Error: Error Domain=com.apple.watchkit.errors Code=2 “The
UIApplicationDelegate in the iPhone App never called reply() in
-[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]”
UserInfo=0x7f8603227730 {NSLocalizedDescription=The
UIApplicationDelegate in the iPhone App never called reply() in
-[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]}
- (voID)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(voID(^)(NSDictionary *replyInfo))reply{NSLog(@"appdelegate handleWatchKitExtensionRequest");NSLog(@"NSDictionary: %@",replyInfo);reply(nil);}
详见the Apple documentation.你也可以返回一个NSDictionary回复(myNSDictionary);无论什么信息,返回到您的Watchkit扩展将是有用的,虽然字典只能包含可以序列化属性列表文件的信息,所以例如你可以传递字符串,但你不能只传递包含引用的字典您的自定义类的实例,而不是首先将其打包成NSData.
总结以上是内存溢出为你收集整理的ios – iPhone应用程序中的UIApplicationDelegate从未调用回复全部内容,希望文章能够帮你解决ios – iPhone应用程序中的UIApplicationDelegate从未调用回复所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)