I seem to be having no luck running any application on the watch itself from a build that was installed from xcode 7 beta 3. I've been doing watch development since before the betas and know these betas have been troubling to say the least to build for. As as result, I've come to realize all the intricacies in troubleshooting apps to display correctly/run. (force quit watch app, reinstall from xcode, reintall from watch app, reboot (xcode, phone watch), etc) but for the life of me, I cannot seem to get any application running that had previously run in the beta 2. Anyone else having this issue? I just get a spinner.
Problems running watchOS apps on device installed from Xcode 7 beta 3
I have found a solution to this:
1. Run app on device from xcode. Wait for loading daisy on watch
2. Force quit app. (Hold friends button until power options displays, then hold friends button again until app closes.)
3. Stop debugging on xcode
4. exit xcode (do not reboot/restart xcode)
5. run app on watch. It should run now.
6. if this does not work start from step 1 again.
This has been working for me most of the time however I cannot get debugging to work.
Update: I have gotten debugging to work sometimes doing the following after the steps above
Then after the app is running on watch, start up xcode and relaunch app while the app is opened.
The spinning icon will show for a long time, about 10mins or so
It will then connect and debugging will work fine for a while. (Changing code and redeploying but you will still have to wait for 10 min each time)
If after 10 mins it does connect, follow the steps from step 1 above.
I cannot get it working consistently but it works most of the time.
*edit If after 10 mins it does NOT connect
I have tried just about every possible scenario and the app on the watch still will not launch. The closest I can get is having the title bar and clock show in the header while the body of the app loads. You can see my custom title text/textcolor so I can see it's loading the app but it never goes further than that. I get to that step by launching, holding down friend/power button til shut off sequence shows, then holding down friends/power button again to force quit the app, then relaunching.
I have this issue as well. Tried a watchOS2 sample app that I found on github and that has simliar issues and that actually just fails to install on teh device. In all cases these work just fine in the simluators.
So I was able to get my apps to launch on the watch. i just created adhoc distribution profile so I could create the ipa and install it from the devices screen under the window menu. So the issue seems to be related to how the app is installed it seems at least in my case. Before I always just tried launching right in xcode just running the app so I could debug if necessary. At least this way I can get the app to install and run.
I have found the solution to get debug working all the time.
1. Go To /Users/<username>/Library/Developer/Xcode/ folder
2. There should be 2 folders, "Watch OS DeviceSupport" and "WatchOS DeviceSupport"
Delete "WatchOS DeviceSupport"
3. Delete all older versions of xcode DeveloperPortal* files. Keep the DeveloperPortal 7.0.* files.
4. Open xCode
5. Delete derived data in Windows->Projects
6. Deploy and enjoy debugging 🙂 🙂
I successfully completed these steps (note that the w in the watchOS folder name is lowercase - to be specific).
However, upon deploying the app to my watch, I am still just getting the spinning daisy.
Note I am attempting to run the WatchKit App on my physical phone + watch target.
The "force stop, stop debug, run again" method causes the app to crash on the watch (app runs fine on phone)
The "force stop, stop debug, quit xcode, run again" method causes the app to just spin endlessly again.
At various points in trying to run the WatchKit app, it will say that it is unavailable or that I have no paired Apple Watch.
I have tried deleting the watch app individually, as well as the phone app (and even letting the deletion of the phone app delete the watch app) to no avail.
How can I even discover where the issue is?
If I run the WatchKit App on my physical watch, I see the extension in the debug list below the active debugging for the phone app (I started that previously). The daisy is spinning, and I see only the bundle identifier and the "Waiting to Attach" message.
I am, however, able to debug both apps in the simulator at this time. Unfortunately, part of my goal is to use the tel: and sms: schemes to fire openUrl on the watch and/or the phone. The one time I *did* get it working in the physical watch, the tel: didn't work (known bug) and the sms: *did* work (I sent a real iMessage!). So now it's just a matter of getting the physical device to match the simulator.
Continuing to try methods for getting this to work on my physical device, I went through the archive process (as if to upload to the app store) and created an ipa file and added it to iTunes and performed a sync to install the app to my device. Yet again, the phone app works fine but the watch app fails to load, and crashes after a preset amount of time (about 30 seconds). I'm really at a loss here.
Since I resolved this, I may as well share what happened.
First, a few important callouts:
in my AppDelegate (which implements WCSessionDelegate too), at the top of didFinishLaunchingWithOptions, is where I have the boilerplate:
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
}
Then, in my ExtensionDelegate (which implements WCSessionDelegate too) in applicationDidFinishLaunching, I have the boilerplate analog for the extension:
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
There's no if statement required here because the watch always supports WCSession.
So where was the problem?
I have an InterfaceController which has a label to indicate if the phone is reachable (while I'm testing).
In the willActivate, I was
a) pulling the delegate from [[WKExtension sharedExtension] delegate] and setting a view property for this controller (because if the ExtensionDelegate is also the WCSessionDelegate, it needs to have a reference to the screen that needs the data, or at least, that's how I'm thinking of it.
b) calling [[WCSession defaultSession] isReachable], but in this case, it appears that the willActivate of the main InterfaceController of a booting app will actually fire BEFORE applicationDidFinishLaunching (which, in retrospect, makes some sense).
So, long story short, if your app isn't running on the watch, and you're using WCSession, be sure you are not using it pre-emptively (I moved my snippet to awakeWithContext which works just fine, and is actually the proper place). Also, you may also wish to always add a check for isSupported to make sure you're not doing something when you shouldn't be (this appears to be the only thing that you can use before calling activateSession to check if things are good to go, and you can see I'm not using it above, for efficiency's sake.
Anyway, yay. Also, if anyone has a better way of doing any of the above, please share.