The UIApplicationDelegate in the iPhone App never called reply

后端 未结 3 507
予麋鹿
予麋鹿 2021-02-13 22:21

I am trying to launch my iPhone app from watch simulator using the below code :

WKInterfaceController subclass

[WKInterfaceController op         


        
3条回答
  •  名媛妹妹
    2021-02-13 22:54

    You need to call the reply block, even if you return nil. The following will resolve your error:

    - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply
    {
    NSLog(@"appdelegate handleWatchKitExtensionRequest");
    NSLog(@"NSDictionary: %@",userInfo);
    NSLog(@"replyInfo: %@",replyInfo);
    reply(nil);
    }
    

    See the Apple documentation for further information. You can also return an NSDictionary reply(myNSDictionary); with whatever information it would be useful to return to your Watchkit extension, although the dictionary can only contain information that can be serializable to a property list file, so for instance you can pass strings but you can't just pass a dictionary containing references to instances of your custom classes without packaging them up as NSData first.

提交回复
热议问题