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
Related
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?
For the past months I have not been able to debug macOS or iOS apps through Xcode. What happens is the following:
Build and run app from Xcode.
Xcode says app is running, but no app has appeared and no debug output from app either.
Kill the process lldb-rpc-server.
App appears and runs as normal, but Xcode is no longer debugging.
Start a new debugging session by attaching it to the app's process.
App freezes again, until lldb-rpc-server is killed.
This OpenRadar has the same description.
I have tried re-installing Xcode (including command-line tools), but it didn't help. Any ideas?
Xcode: Version 9.3.1 (9E501)
MacOS: 10.13.4 (17E199)
The cause of this was that I had installed a GDB/LLDB-extension called Voltron. I was unaware that the installation also created/modified the .lldbinit in the home folder. Removing this file fixed the issue. See also this issue for Voltron.
Got some very good help from Apple.
I had received this warning msg when device was locked and I was running app on device, so when device is unlocked this warning goes
Up until today, I've been able to build, run, and debug my watch app and iOS app at the same time. When I build and run, the debugger attaches to the watch automatically. Then I have to manually attach the iOS debugger. I have been following these steps and they always worked perfectly. I can hit breakpoints on both on the watch and the phone (which is what I need to do to be able to debug things like sendMessage or applicationContext).
The problem now is that when I go to attach the iOS app to the debugger manually (via Debug -> Attach to Process), it doesn't show up in the likely targets or in applications at all, even though the app is running on the phone.
I checked my schemes and made sure that the targets were still correct- they are.
I even tried Debug -> Attach to Process with PID or Name. When I try to attach the iOS app by name, I get an error saying Will install Watch App called with bad bundle identifier '(null).
Why is my iOS app no longer a likely target? How can I get it to attach to the debugger again while my watch app is also attached?
I use another way to debug on watch app and iPhone app at the same time. I run this script when watch and iPhone simulators are running on my Mac. Then launch my watch app or iPhone app on the same simulators. I can observe both log at the same time.
P.S. These log are come from console, so you should use NSLog(), not print().
I'm rewriting my watch app to work in watchos2 but have problems debugging on the actual watch (XCode7). What is the correct way how to do this?
1) Obvious (but naive) approach - connect your phone with paired watch, in XCode select Extension scheme to run on Phone + Watch. Click play and it should work, right? This seems to work only just after fresh pairing and breaks very quickly (after few debug runs). See issues and behaviour below
2) Run phone app first then add run of extension - this approach worked for me longer but eventually broke as well.
3) Unpair and pair again - more than painful experience, time consuming and not practical at all. Will help for a while though.
Main problems:
phone app not communicating - I've seen not reachable or messages just time out
watch app stops running - XCode is saying it's running but it's not - won't even attach. If I run it manually on watch most of the times it will attach but then the phone app is not reachable
watch app won't even install - I suspect when the XCode is saying it's running it in fact it doesn't because when I remove the app from watch and then run XCode goes through the whole install process and "running" but the icon doesn't even appear on the main screen
phone stops reacting when I use option 2) and try to run something else while app is attached
phone seems to be blocked, selecting other apps (even going back to my app) won't work until I kill the session
Setup: The phone and watch is paired correctly, phone can see watch, watch can see phone, other apps are working. Watch "trusts" the computer as well, app is "shown on apple watch". Phone is 5s 9.0.1.
I've tried various restart combinations (phone|watch|xcode|mac), shuffled cables, disconnect, reconnect, etc. but that didn't help either.
Did anybody find a usable way how to debug watchos2 app from XCode? Nobody else seems to be complaining about this with released XCode7 though I've seen lots of similar issues in beta builds.
Use Apple watch recharging cable, connect your watch to developing Mac that runs Xcode.
It provides much more successful and fast debugging.
I have been dealing with the same issue this last days, I just updated to iOS 9.2, watchOS 2.1 and XCode 7.2, and now everything works.
After update XCode to 7.2, iOS9.2 my phone and WatchOS2.1 my Apple Watch the debug process is better. I suggest to update all your devices.
My Watch OS2 app is running on Simulator okay but all the breakpoints I set in awakeWithContext, willActivate ... even when they have run and produced the result, the breakpoints are not hit.
In Debug Navigator, all I can see is "Installing and Waiting to Attach":
How to get these breakpoints hit for the Watch app?
The breakpoints for iPhone app hit normally when I run the iPhone app.
I have done many things - restart the Xcode, reset both Simulators, uninstall Watch app inside iPhone Simulator ... Nothing works, still "installing and waiting to attach"
Can anyone help? Thanks a lot.
P.S: Here is a relevant question.
I have installed Xcode 7 beta3, and this is not happening anymore. Now the breakpoints are hit.
Cheers!