I am trying to launch the parent ios app from watchkit app. I'm using url scheme to launch the app.But it seems like
-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
is nevered called. It seems like watch app does launch the app in backgound. But the parent app does not handle the watchkit request. I tried my approach in a new project and it works perfectly. Is there any thing I need to pay attention?
I've already tried to Debug>Attach to process>myapp and put a breakpoint inside handleWatchKitExtensionRequest method to confirm if it is called and it isn't called.
Here is the progress, I call openParentApplication when a button is clicked in watch app.
@IBAction func viewOniPhoneAction() {
let userInfo: [NSObject : AnyObject] = [
"userID" : user.userID
]
WKInterfaceController.openParentApplication(userInfo, reply: { (userInfo : [NSObject : AnyObject]!, error : NSError!) -> Void in
})
}
Here is my app delegeate
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply
{
NSDictionary *replyDict = @{@"response": @"done"};
reply(replyDict);
}
I tried reply()
in handleWatchKitExtensionRequest
but I got this error in reply block from watch app
Error Error Domain=com.apple.watchkit.errors Code=2 "The UIApplicationDelegate in the iPhone App never called reply() in -[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]" UserInfo=0x60800026e0c0 {NSLocalizedDescription=The UIApplicationDelegate in the iPhone App never called reply() in -[UIApplicationDelegate application:handleWatchKitExtensionRequest:reply:]}