19

my configuration: Apple Watch (WatchOS 2.0.1), iPhone 5S (iOS 9.1) Xcode 7.1 on MacOS X El Capitan.

I can run my app on the iPhone just fine. However, when I try to run my app on the Apple Watch, it seems like it's not possible. What I see in the status bar is the usual steps

Building MyApp on Apple Watch

Installing to Apple Watch

Running MyApp on Apple Watch

And then, in less that a second, it shows

Finished Running MyApp on Apple Watch

As if I had just pressed the stop button in Xcode (but without my having pressed it at all). No error message or warning. It just stops.

As a result, I'm not able to debug my app on the Apple Watch to see the log messages, memory usage, etc.

Any ideas? Thanks in advance for your help!

Community
  • 1
  • 1
ajpallares
  • 777
  • 4
  • 16

4 Answers4

20

When this happened to me, I fixed the issue by:

  1. Making sure there are no problems with your Main.storyboard and it has an initial view controller.
  2. Deleted app on phone
  3. Rebooted phone
  4. Rebooted watch
  5. Quit xcode and rebooted mac
elprl
  • 1,940
  • 25
  • 36
4

You could build the app to iPhone first, wait the watch app sync to watch. (Or you could sync it in companion by turn off and turn on the install switch manually)

Then keep the app running on watch, select Xcode->Debug->Attach to Process->XXXXX Extension(the name of your watch extension)

After a while you should be able to debug the watch app.

RoCry
  • 99
  • 3
  • Yeah, I've tried that approach and it works, but this way I cannot see the printed `NSLog`s. Before, I was able to launch the app in the Watch normally as I do with the iPhone, but it suddenly stopped working. That's what I'm trying to fix. Thanks for your help, though – ajpallares Nov 06 '15 at 08:35
  • 1
    @ajpallares By the way, you could get the logs from Xcode->Devices->Apple Watch if you don't know this already.. – RoCry Nov 06 '15 at 10:46
1

After restarting all my devices twice to no avail, here are some tips that sometimes solve the issue. (This whole thing is a headache.) I usually use the combination of these 3 things and it works 90% of the time.

  1. Build for a simulator and then switch back to a real device again.

  2. Switch the Info/Launch scheme setting to "Wait for the executable to be launched", run the project and then switch back to "Automatically".

    Scheme settings

  3. Delete the Derived Data folder located under ~/Library/Developer/Xcode/DerivedData.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
0

This drove me up the wall when starting out. I found 2 solutions:

  1. Stop wasting time developing for Apple Watch

  2. Found my XCode was disconnecting from my Apple ID. Went to XCode -> Preferences -> Accounts. And noticed "Your session expired, please log in." I could run to iPhone no problem with this error but on Apple Watch it would get stuck on "Running ... Apple Watch"

enter image description here

Vlad
  • 5,727
  • 3
  • 38
  • 59