Xcode fails to install watchOS app onto Apple Watch device - xcode

Xcode "Run" operation fails to install a watchOS app on a real Apple Watch device with error description:
The host is not paired with the device.
Context:
First time ever trying to install a watchOS app from Xcode onto an Apple Watch device for testing/debugging
The watchOS app is an official Apple SwiftUI tutorial example
Assume latest versions of MacOS, Xcode, watchOS, Watch device, etc.
The selected scheme is the watchOS app target
The selected device is "[my Apple Watch name] via [my iPhone name]"
The Apple Watch is in fact paired with the companion iPhone, despite what the Xcode error says

The Apple Watch has not yet trusted this particular Xcode, Mac, developer account, or app. The Apple Watch should have received a "trust/don't trust" notification, but did not; this may be a bug on Apple's part.
However, we can force the notification to pop up by simply restarting the Apple Watch device. The Watch should receive the notification immediately upon restarting. Click "Trust" in the notification on the Watch. Then retry, from Xcode, the "Run" operation. The watchOS app should now install OK on the Apple Watch device.

What needs to be done is restarting both devices, iPhone and paired Apple Watch, connect iPhone to computer with cable. When the trust/don't trust notification appears on the Apple Watch or iPhone obviously choose 'trust'. Then the app will install again.
What it stops from running on your watch sometimes is if you have a simulator debug session open still. It says it can't install because there is another debug session running (but not on your watch..)! Closing this simulator session will allow you to install on your watch.
Other times xCode is building fine and thinks it's running the app on your watch, but it runs an old version and you don't see any changes made. Then you have to delete the app from your Apple Watch.
What also sometimes stops it from running on the Apple Watch are in Xcode the Preferences->Accounts->Profiles. Installing them manually will help in that case.
If nothing works uncouple your apple watch from your iPhone and recouple again.
Why isn't this still been resolved? I see people complaining about it for several of years now. Is this bug only related to standalone apps?

Related

How do I run my application from xcode on Apple Watch?

I am trying to run my first WatchKit application on Apple Watch (watchOS 7) from latest XCode (12.0).
I can select emulator as a destinantion, but I have no idea how to add my real watch to the list, so I can start testing on a real device.
I have iCloud account, and it seemed sufficient to run iPhone applications, but not Apple Watch.
How do I make it work?
Ok, I am not the sharpest tool in the shed.
Apart from assigning a proper Team to the Project, make sure you have your iPhone (to which the Apple Watch is paired) connected to your Mac via cable.
The "connect your iPhone using cable" was not thet obvious to me. I assumed it got the device from iCloud account.

Xcode does not install watchOS app for debugging on device

This is on watchOS 4.3 beta (15T5165e) and Xcode 9.3 beta (9Q98q), but I don't think it's because of them being in beta because another WatchKit project ran on device just fine. I have tried unpairing/repairing, restarting the iPhone/Watch/macOS/Xcode (while making sure to to tap "trust this computer" on the watch) but Xcode still says "Running" in the WatchKit scheme without actually installing and running the watchOS app, eventually saying "Watch app launch timed out."
Disable WiFi on the iPhone. This helped me.
I came to this after following #Appyx advice to activate a hotspot on iPhone. Then I noticed, that in hotspot mode WiFi is automatically disabled and tried this.

Xcode Run Apple Watch target results in Finished running app on Watch

I am trying to debug my watch app. I build and try to run as usual. It says Build succeeded, installing to watch etc. but then, instead of launching my app, it says Finished running app on watch. I've restarted Xcode, reinstalled my app on watch etc. but no avail.
What am I doing wrong?
I've also restarted my Mac, my iPhone and my Watch. It then worked.
I restarted everything and it still didn't work. However, after the restart when I first run the app I received an error: Device doesn’t support wireless sync. With this, after disabling the wifi on the watch, things went back to normal.
From my experience, restarting all devices (iPhone, watch, and mac) sometimes allows the app to build on the watch, but it is very frustrating and a long process for a "maybe."
Especially when I get the Device doesn't support wireless sync. the most consistent solve has been disabling wifi on both the watch and the iPhone. Also, have the iPhone connected directly to the computer with a genuine cord.
Good luck.
Also, if you were using the simulator, stop it and quit the simulator before trying to compile to the real device.
You just have to attach the Xcode debugger to the process which is running on the watch!
Xcode -> Debug -> Attach to Process > "name of your app watch extension"
After that Xcode displays "Running ... Extension on Apple Watch" and you can start debugging

Xcode and No paired Apple Watch

I've already seen a similar question that doesn't give a valid answer to me: In Xcode I see (no paired Apple Watch) even though the watch is paired and the watch's UDID is registered
I really cannot understand how to have my Apple Watch working on Xcode.
Even if I create a new project or if I add a watch target to an existing app I always see in the device choice this status "My iPhone (No paired Apple Watch)" but my Apple watch IS paired...
Sometimes the message changes and I get "My iPhone (Paired device not available for development)".
My current environment is fully updated to the latest software versions (Xcode, WatchOS, iOS and OS X).
Are there any magic solution to make it work?!
For what it's worth, I just ran into this problem. My phone and watch are both registered, etc. I checked my provisioning profiles on the developer portal and they happened to be invalid (I reset something along the way).
After fixing them, downloading, and double-clicking them, the watch appeared as paired again.
Just experienced this. It was caused because the ios app which contains the watch app was out of date on the phone. After switching target to the ios app and building and run it on my phone, I was then able to switch back to the watch app and successfully run it on my watch.
Xcode Version 8.2.1 (8C1002). macOS 10.12.3 (16D32).
On Xcode 10 beta, I experienced the (no paired Apple Watch) scenario
After a few moments, the "Do you trust this computer" dialogue came up on the watch. after accepting it, Xcode saw the watch right away

How to solve this error in Xcode when testing your app on the Apple Watch

I've tested my Apple Watch app on the simulator and it runs perfectly...However I couldn't test my app on the actual Apple Watch device:
I ran my iPhone app in Xcode.... Once completed it will install the app on Apple Watch.
Then, Apple watch app will launch and stuck on launching screen with "loading" spinner on the Apple Watch device.
The Apple watch will just close itself and this error will appear in Xcode:
You need to run the your iphone app scheme not the watchapp or extension scheme, once you will installed your iOS application on your device with watch kit support.
After installing the iPhone, you need to check your watch, application will automatically installed on Watch. If still you are not able to see the application then you need to visit application "Apple Watch" and scroll down to see your application and turn on apple watch support for your application.
If you are running the Watch OS2 app then after deploying the app on the Watch, you will need to reboot the Watch. Once rebooted, the Watch app will now run and not stuck anymore, loading time is about a few seconds only.

Resources