I know that the openParentApplication
api in watch kit extension can open the host app in the background but not in the foreground.
I also tried using openUrl()
api of NSExtensionContext
as below:
NSExtensionContext *ctx = [[NSExtensionContext alloc] init];
NSURL *url = [NSURL URLWithString:@"myScheme://today"];
[ctx openURL:url completionHandler:^(BOOL success) {
NSLog(@"fun=%s after completion. success=%d", __func__, success);
}];
[ctx completeRequestReturningItems:ctx.inputItems completionHandler:nil];
Here too the host app is not launched. Am I missing something? or is it not possible to launch the host app from watch kit extension?
As of Beta 3 of iOS 8.2 it is currently not possible to open iOS app to foreground.
As you said openParentApplication
can open app in background. Unfortunately there is no sign of API to open app on iPhone.
Multiple posts on Apple Dev Forums mentioned that it's not possible
https://devforums.apple.com/message/1076125#1076125
Correct, a notification can still declare a background action that the iPhone app will handle, so in that sense it can launch the iPhone app. But the iPhone app cannot be brought to the foreground by a WatchKit app.
And other post
https://devforums.apple.com/message/1082620#1082620
On a device, it[Watch app] will not - bring your iOS app to the foreground.