Is there any way to launch the iOS App from Apple Watch?
Edit:- Tried using both api below but doesn't work:-
Apple Watch Code
Calling Inside interfaceController.m
+ (BOOL)openParentApplication:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo, NSError *error)) reply; // launches containing iOS application on the phone. userInfo must be non-nil
iOS Code
Calling Inside Appdelegate.m
- (void) application:(UIApplication *) application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
Get apps from the App Store on your Apple Watch Tap an app to see its description, ratings and reviews, screenshots, release notes and more. Tap the price or tap Get. When prompted, double-click the side button under the Digital Crown to download and install the app.
On your iPhoneOpen the Find My app. Choose the Devices tab. Select your Apple Watch to see its location on the map.
Restart your Apple Watch But it may fix such app freezing and crashing issues. To restart your Apple Watch, long press the side button and drag the power off slider to the right. After waiting for a minute or so, press the same side button to power on the watch.
The answer is actually pretty interesting. It is YES
and NO
.
You CAN open the app in the background through the openParentApplication:reply:
method. That will launch the app in the background if it is terminated or backgrounded. It will just call the app if it is already in the foreground.
You CANNOT bring the iOS App to the foreground from the Watch Extension if it is not already foregrounded. That is against Apple's policies. While you can actually do it in the iOS Simulator, Apple has confirmed that you cannot do this on the device or submit the solution to the App Store. See this article on the dev forums for more information.
If you need to bring the iOS App to the foreground, the only way you can partially do this at the moment is to use the Handoff APIs. Here is another link to the Handoff Programming Guide. Once you read both of those documents carefully, you'll see exactly how the Handoff system works.
To implement, you'll need to add the WKInterfaceController
updateUserActivity:userInfo:webpageURL:
in the Watch Extension. Then you'll need to implement the UIApplicationDelegate
application:continueUserActivity:restorationHandler:
in your iOS app. Unfortunately, you will not be able to test this solution until you have an Apple Watch, but the docs clearly state this will be supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With