Reputation: 628
When I activate my WatchApp InterfaceController. First thing it does is attempt to wake up the parentApplication (or as according to documentation, activates it in the background) by calling "OpenParentApplication" method.
However, The method is unresponsive until I manually activate the app on parent iPhone. It also greets me with a "XXX Unexpectedly Quit", which means when I was calling my host App, for some reason it crashed it.
After the activation, I can freely exchange information with the "OpenParentApplication" method.
According to documentation, the method
Essentially, just calling the method should wake up the parent regardless of the reply closure.
My code is extremely type safe, with nil value causing the crash out of the question, what could it possibly be?
PS: I cannot debug the host App since I can only attach to process after the host app is launched, which it never did.
Upvotes: 1
Views: 823
Reputation: 1778
Actually you Can debug main application after launching watch extension. After your extension started in Xcode go to Debug -> Attach process -> your main app. This will enable you to use breakpoints and logging. If your app is missing there, try launching it on device first and then go and try attaching it again.
Upvotes: 0
Reputation: 20187
Since openParentApplication
launches your application in the background, a number of methods that would automatically be called when your application launches will not have been called. For instance, in a normal launch your initial view controller will be calling viewDidLoad
, viewWillAppear
, viewDidAppear
. If any of these methods configure critical aspects of app state on which non-interface elements rely, then your app is at high risk of crashing when launched in the background—but the app would not crash if it had been previously manually launched before openParentApplication
was called.
Upvotes: 2