5
votes

I have configured the WatchKit App to run on iPhone 6, the WatchKit App Scheme Executable points to WatchKit App.app, Watch interface points to Main, but the IOS App is not starting only the WatchKit App.

When I select the WatchKit App to run on iPhone 6, the iPhone 6 simulator is starting, I see a black screen for a second after that the simulator returns to IOS level but the main app is not starting, only the WatchKit App on the Apple Watch simulator. I can not figure out why the IOS App is not starting?

3

3 Answers

4
votes

In order to debug the iOS app while running the Watch Extension, you should follow the steps explained here.

You also need to understand that the iOS App does not have to be running while the Watch app is running. You have several combinations of possible runtime scenarios...all of which your iOS app and Watch App must handle seamlessly.

  • iOS App is running but not the Watch App
  • Watch App is running but not the iOS App
  • Both apps are running in the foreground
  • Watch App is running in the foreground and iOS App is running in the background

I have also posted some additional information about launching the parent app from the Watch Extension as well as sharing data here.

Hopefully that helps.

3
votes

If you want to see NSLogs from the container app, you can do this:

  • put a breakpoint as early in your watch app's processes as possible
  • run the container app
  • stop the container app
  • run the watch app and let it hit the breakpoint
  • with the watch app running and debugging connected, go to the simulator and open the container app by clicking on it
  • go back to XCode and go to Debug > Attach to process > Your container app

You should now be connected to both processes, and see breakpoints and logs from both. You can use the thread navigator in the left pane to switch between apps (which you'll need to do to get the watch app running again).

Note that an early breakpoint in the watch app is optional, I just find it useful to make sure any early breakpoints are caught.

2
votes

There is a bug at the moment which hasn't been fixed yet. To get around and launch the iPhone app do the following:

1) Stop any process in Xcode.

2) Build and run the iPhone app.

3) Stop the iPhone app once launched.

4) Switch to the WatchKit scheme extension and build and run it.

5) Open your iOS app from the iPhone home screen by pressing its icon.