Debugger not working on Apple Watch Series 3 - ios

Problem: I cannot get the Xcode debugger to attach to my new Apple Watch
Hardware:
Apple Watch Series 3 (no GPS)
iPhone 6s
Where it works:
Debugger works fine on the physical iPhone
Simulators work great (both iPhone and Apple Watch)
Things I've tried:
Restarting all three devices (Mac, iPhone, Apple Watch)
Formatting and reinstalling iOS 11 on my iPhone
Unpairing and repairing the Apple Watch (done this 1000 times)
Completely removing all of Xcode and reinstalling from the app store (deleting simulators, sdks--everything)
Other things:
I've made sure to trust this computer
I've started a brand new project just to make sure it's not something in my code.
It shows up in Xcode as a valid target, but when I build it just says "Running App on Jason's Apple Watch." It installs the app, but doesn't start it, and the debugger doesn't hit any breakpoints.

Attempt to attach the debugger manually to the Likely Targets.
XCode -> Debug -> Attach to Process -> Likely Targets -> Your Project
I had this same issue and am uncertain of why this started happening to me. If someone knows how to permanent fix this problem, please feel free to edit this answer.

It started working. Not sure what specific thing it was, but I enabled all the checks in the debugger scheme. Posting in case this helps someone else:

Related

Xcode 12: Failed to start remote service "com.apple.debugserver" on iOS device

I updated my Xcode to Version 12.4 (12D4e) and after that I am unable to run my app on my device
iPhone X iOS 14.4.2.
Its alway show this Error
When I check my device connected status, Its show as connected
Action I applied
Clear DerivedData folder.
Unpair device and connected again.
Drank 20+ coffees.
I was able to fix the Xcode 12 app install/deployment issue described above:
Failed to start remote service "com.apple.debugserver" on device.
Domain: com.apple.dtdevicekit
Code: 811
Recovery Suggestion: Please check your connection to your device.
User Info: {
DVTRadarComponentKey = 261622;
}
...
by doing the following steps:
Quiting Xcode.
Deleting Xcode cache directory (ie, rm -rf ~/Library/Caches/com.apple.dt.Xcode).
Rebooting the offending iOS device.
Connecting the iOS device to Xcode by cable (instead of wireless network connection).
Starting Xcode again.
By the way, I've a setup very close to yours:
Xcode 12.5 (build 12E262) and
iOS 14.5.1 (on a iPhone Xʀ device)
1st solution
I fixed this by:
Closing Xcode
Deleting the current iOS version in my folder that's related to my device.
~/Library/Developer/Xcode/iOS DeviceSupport
Restarting Xcode. Wait a little bit for it to refresh and copy cache files in my case then Run.
Based on Can I delete data from the iOS DeviceSupport directory? it's ok to delete the iOS DeviceSupport folder.
I noticed when I did it and reconnected my device it re-downloaded the iOS device Support files.
If the support files don't download and the cache files are not copying, try restarting your computer as well.
I started also getting this error:
Errors were encountered while preparing your device for development.
Please check the Devices and Simulators Window.
Restart your phone and reconnect it to the compter if this happens. Then you should get a message in Xcode saying:
Preparing your phone for development.
2nd solution
Unpair the device in Xcode.
Clean the project.
Unplug and then restart iPhone.
Restart Xcode.
3rd solution
If none of the above worked, I was able to run the program by re-enabling Connect via Network.
After doing this now I can run project via USB.
4th solution
I submitted this bug to Apple. Apple also suggests this can be caused by faulty data cords. Maybe try another cord as well.
Unplug the iPhone, Turn it off and again turn it on and reconnect. It worked for me. Sometimes iPhone Debug connection network server clogs up. When you restart iPhone it reinitiate the connection.
This issue keeps happening and it seems like there's a myriad of reasons that may cause it, and so there are a lot of solutions that fixed it for people. Someone even suggested that none of the fixes actually work, and it's only the fact that time passes as we try different solutions that actually fixes it. Nevertheless, I will share what worked for me and what I found so far.
a. In the past, the issue was most often caused for me by using an older version of Xcode with a newer iOS. Apple doesn't always release the version of Xcode that supports the latest iOS at the same time, and this issue sometimes happens as a result of that. There are people who suggest right clicking the Xcode App > Show Package Contents > Developer > Platforms > iPhoneOS.platform > Device Support and renaming the folder for the latest supported version to the one running on the phone (for example renaming 16.0 to 16.1). I've had better luck with using the Beta of Xcode if it's not out yet (in this case using 14.1 RC2 instead of 14.0.1).
b. Incrementing the build number and setting a Display Name. This seems to have fixed the issue after nothing else worked. Again, this seems very random, so it could be unrelated, but it did fix it in my case after nothing else suggested on all the threads about this worked.
c. Deleting the profile in Settings > General > VPN & Device Management
Other suggestions I've seen across threads:
Restarting the device (seems to be the most popular solution)
Unpairing the device
Checking device status under Window > Devices and Simulators. There may sometimes be some further info about what is going on here, the device may still be preparing for development or downloading symbols or whatever
Using another cable. This never worked for me, after trying with 3 cables, 2 from Apple and one 3rd party, but others reported it worked
Deleting Derived Data (use Dev Cleaner or rm -rf ~/Library/Developer/Xcode/DerivedData
Uninstalling the app manually from the device
Resetting Network Settings
Force restarting the iPhone
Apple really needs better errors and less ridiculous bugs like this.
I had to update Xcode to fix this issue because my version of Xcode did not support my up-to-date iOS version.
I've had the same issue and also had the problem that I wasn't able to connect my device by cable (it popped on and of), so I had to use wifi connection on Xcode.
I was able to see the icon of the app created by Xcode on my iOS device, but whenever I tried to start it, it won't do so giving the "Untrusted Developer" error message.
I fixed this by going to:
Settings > General > VPN & Device Management > Developer App
Here you have to chose the App and consent to trusting it.
I reset the iPhone network settings and it works!
I have the same problem, my solution is update my ios version(15.1 to 15.2 beta)
I tried all the resolvent, nothing worked
restart iOS, Xcode, macOS
clear DeviceSupport, Caches
unpair iphone, change lighting cable
Then I find my ios version(15.1) does not exist in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport.
I try to fix it, but failed.
Finally, I can only update my iOS device to 15.2 beta version, It solved! Xcode is update to beta version too.
My devices original version:
iOS 15.1
Xcode 13.1 (13A1030d)
I'm on Xcode 13.3 and I fixed this by unplugging and plugging the cable between my MacBook Air and my mini iPad 3.
I fixed it by,
Following the steps : Window > Device and Simulator > Select your device and Right Click on it > Unpair after that re-connect your iOS Device then boom... Clean builds and run the app, it will work for you.
Upon solutions aren't working for me. Restart my iPhone then all well done.

Xcode 12 Apple Watch Debug Cycle

I just got back into iOS / WatchKit development after a ~8 year break. I'm having a really hard time making an app for the watch, because
Simulator is not helping because random things seem unsupported (most recent example being WCSession.transferFile, which apparently is a bug)
On device is not helping because the loop to get it to run on device is completely out of hand, and I was not able to get either logging or debugging to work when running on device. (My main problem is that if I do CMD R in Xcode with my Watch selected as target, it builds, and says running, but never launches the app. If I launch the app manually I find it's not the most recent version. I have to go and remove it from the watch, and re-add it, which then causes Xcode to not be able to run it anymore, which means I have to restart Xcode. What.)
So my question to more experienced devs is: what's your debug cycle when writing Apple Watch apps?
I'm running Xcode 12, watchOS 7.1, on Mac OS 10.15.7 (not Big Sur which may be some cause of issues)
Some steps that help for on device debugging:
To re-install the watch app, select the iPhone app in Xcode and build and run that. This will also re-build and re-install the watch app as needed.
Open the app manually on the watch
I still haven't figured out how to get a debugger or console, but for now my hack is to have a label on the watch that I use as my on device console.
This is almost certainly an Xcode 12 issue. At least since Xcode 12.5 my app has not worked with watch simulator (it can't connect to the phone simulator) and I get no debugger with a real device.
Using Xcode 12.3 seems to work.

My shortcut doesn't work on the watch, in production only

There are a few part to this problem:
Running my intents extension scheme on the "Watch App" works fine. I can track the progress in the debugger, great.
But when I run the ap on my apple watch––simulator or real device, and not through xcode––I can't use my voice shortcuts. I get the message "sorry, there was a problem with the app" every time
The shortcuts work on iPhone all the time. Any iPhone, any build, from anywhere
Because this only happens while not debugging, it's very difficult to troubleshoot the issue
So unfortunately this is a pretty broad question: does anyone have any suspicions as to why this is? Any resources to help me troubleshoot this? I've been playing around with it for a LONG time without much success.
I've already tried a few things: switching up the schemes, iOS and watchOS versions, debug/release builds, etc. I'm beginning to think there's actually an issue with my code––my suspicion is that the shortcut is timing out––yet all the optimizations that I've made haven't amounted to any good results.
To give some background on my dev environment, I'm using Swift 4.2 and Xcode 10.1 on a Macbook running the latest version of Mojave. My test devices include a 40mm series 4 watch with watchOS 5.0 and an iPhone X running iOS 12.0.
Then there's the simulators. I've tried every version of iOS 12.* and watch 5.*
EDIT: Also, to clarify, this error occurs in the confirmation phase of my shortcut, not the handle phase.

Apple Watch simulator stuck loading in iOS simulator

When I run WatchKit App, Apple Watch simulator stuck loading. Like this,
But, I can run that for the first time, that is, it is the first time after restarting iOS simulator.
If you quit iOS simulator and then restart that, you can run Apple Watch simulator only once.
Now I need to restart simulator every time. That's really annoying.
Is there any good method for this situation?
Version 8.4 (SimulatorApp-565.9 CoreSimulator-117.15)
When this happens to me, I am usually successful after the second or third launch of the app (without quitting Xcode or the simulator). This has been the case with both Xcode 6 and Xcode 7.
If you provide more details, I can probably refine this answer better. Here are some things that may work for you, depending upon whether you're running Xcode 7 or 6:
Try deleting and re-creating the target scheme: SO: Apple Watch Simulator Issue
A variant of the above: Tutorial on Apple Watch from Natasha the Robot
Some suggestions that have worked for some people on Xcode 6.x: SO: watchkit simulator won't load app
Regardless of the work-around, if this isn't due to user error, perhaps the best thing to do is to submit a bug report to Apple.
Here are some suggested files to include when submitting a Radar Bug Report to Apple (See this developer form thread):
~/Library/Logs/CoreSimulator/[UDID of Watch]/system.log
~/Library/Logs/CoreSimulator/[UDID of Phone]/system.log
~/Library/Logs/CoreSimulator/*.log
A sysdiagnose taken just after reproducing this issue.

Can't install WatchKit app on Apple Watch

I have a WatchKit app that runs fine in the Simulator. But when I try to run it on an actual device it never finishes installing and never provides any error message or feedback.
The iOS app installs and runs fine. I bring up the Apple Watch app on the iPhone and it lists the app and shows the correct icon. Selecting that, the "Show App on Apple Watch" switch is on. Underneath it it says, "Installing...". And it stays there.
I can also see the app icon on the Apple Watch. Selecting it just shows the spinning wheel indicator as if it is trying to load.
Things I've tried based on other suggestions I've found here, on the Apple Developer forums, and around the web:
Verified that all app bundle IDs are correct and match.
Verified that the deployment target is iOS 8.2.
Verified that the WatchKit App runs in the simulator.
Verified that my provisioning profile includes my Apple Watch's UDID.
Verified that my Apple Watch shows up as a "Paired Watch" in Devices.
Deleted the app from my phone, and then rebooted my phone, watch, and Macbook before reinstalling.
None of the above work. Any suggestions?
Thanks!
Thomas Aylesworth
A friend who works on the USA Today iOS team, including the Apple Watch app, suggested I go to the project settings for the WatchKit App target and set "Skip Install" to NO. Sure enough, after doing this, I was able to install.
I've found it very useful for reading the iPhone console log. (Not to be confused with crash logs).
Use Xcode --> Window --> Devices -- select your plugged in iPhone, and make sure the log screen lower left arrow is down.
In my case, I had invalid provisioning profile entitlements, which were corrected via the Apple Dev portal, and re-downloading the profiles -- after making sure the entitlements were correctly being set in the WatchKit App Capabilities.
Check Info.plist file. In my experience if there is something added there that is not supposed to be there, it will cause this behavior. I added NSLocationWhenInUseUsageDescription and it caused this same issue.
I have found a similar problem due to my storyboard referencing an image which I later deleted (I no longer actually used it anymore). This gave the symptom of running ok on simulator but not deploying fully on hardware as you are seeing. To exclude this potential problem go through each image view on your apple watch storyboard and look out for the exclamation mark against image view entries.
I had the same problem but for me it actually turned out that the Apple Watch was running a WatchOS version lower than what what I had in XCode. I could not see a runtime warning about this (it just silently failed), but when selecting WatchKit scheme in XCode with device connected there was a small warning about version requirement.
You can also try deleting the watch app on the watch by long tapping on the icon and then you should get the giggle UI with a X on 3rd party apps. You can then delete the watch app and retry the install.
I was getting this error too, and I got it to install, after creating a new project from scratch in the non-beta Xcode, and copying my assets and code into the new project. I had the same problem, and tried everything that people suggested on other posts, without any success, including everything that you listed above.
Apparently, there was something incompatible with the way the project was stored in the beta Xcode, that I had created for the WatchKit app.
Here's what works for me with iOS 8.3 and Watch OS 1.0.1:
Make sure your app is finished installing on your iPhone.
Restart the iPhone by holding down the Home button and Wake/Sleep buttons.
Launch the TestFlight app on your iPhone.
Staying in TestFlight, go to your app's detail page and toggle the Install on Apple Watch to the On position.
Press the Home button on your iPhone to exit the TestFlight app.
Press the digital crown on the Watch to get to the Home screen. An icon for your Watch app should appear and begin installing.
make sure your app support 64Bit, otherwise it cannot run on Watch,just spinning there.
Did you add a custom entry to the of your Info.plist of the WatchKit App
This isn't allowed and it will fail validation and will just sit on Install...
Checkout the device console log for information on it
Yeah, had that problem too.
I deleted the Xcode Beta (and the .dmg) downloaded it again and installed it.
Don't have that problem anymore.
In my case, I disconnect the iPhone and the Mac, reconnect them via data line. Then something appear on my watch, a choice, agree or disagree, agree it. After that, Xcode begin to install symbols for watchOS 2.1:
When this is done, you can check it in Library->Developer->Xcode->watchOS DeviceSupport->Watch1,1 2.1 (13S661)->Symbols
Then I disconnect the watch and iPhone, reconnect it. Now I can install WatchKit App on my watch.
I have followed the answer by #hunterleebrown to see the log and found that the WatchOS version is not updated (i.e. Watch OS version is lower than the required version).
Here is the screenshot [ The log says (4th line): The system version is lower than the minimum OS version specified for bundle at ... ...]:
Then I went to the iPhone's watch app's-->general settings-->Software Update and found the watch OS is not updated (which is obvious). Then I downloaded the update and installed it. Then it worked!
Note: I also tried quitting XCode, restarting iPhone and Watch but didn't work for me.
Press "Trust this device on Apple Watch"
I had the same endless installation issue ending with a Time Out error and I finally fixed it thanks to this answer: https://stackoverflow.com/a/61636074/2854405
I had to:
Unpair my iPhone (from the "Devices and Simulators" screen),
Exit Xcode
Replug my iPhone
Trust the iPhone again when it was prompted
Start Xcode
Rebuild
I also had the same issue.
#SwampThingTom suggestion is good, but it changes the archive format as well size increases too.
In my case, the issue was DER entitlements not working only watch app, mobile app was fine.
Make the changes as per the comment over here This Code Signature is no longer supported when building app on iPhone 12
Upgrade to Xcode 13.1
In my case I resolved this problem when selecting the WatchApp target to creating AdHoc.
So, for example, there is three targets in project:
Demo;
Demo WatchKit App;
Demo WatchKit Extension;
If create AdHoc with Demo target, you will get infinite installation.
If create AdHoc with Demo WatchKit App target, the problem goes away.

Resources