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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…