Xcode doesn't launch the watchOS Simulator - ios

Problem
Xcode (9.4.1) doesn't launch the Simulator app at all when I try to run a watchOS app.
Steps to reproduce
Select the scheme
Hit run
Build succeeds, waiting to attach.
And here is where it gets stuck. Nothing happens from here. The Simulator app never gets launched.
Simulator Launch Workaround
The Simulator can be opened manually. Then, Xcode installs the watchOS app on the watchOS Simulator and the iOS app on the iOS Simulator.
But here is the next problem: Once it has installed the apps it doesn't launch the watchOS app, even though i've set the launch to Automatically in the Scheme Editor.
watchOS App Launch Workaround
Go to the watchOS home screen and tap the app icon to open it.
I know that all the workarounds should not be necessary. And it all worked before.
Other information:
I had installed the Xcode 10 beta 3 recently but I removed it already
I removed the derived data

I had to virtually connect the watch and phone via simulator to get it running. Like you would on iPhone to get it connected.
I found it odd but after that I had no issues. Go to the watch app via the iPhone simulator and pair the virtual watch then Presto!

Related

How to open iPhone simulator and paired watchOS simulator at the same time?

I am learning development for the Apple Watch app paired with the iOS app. I created an iPhone simulator and paired it with a watch simulator. I was going through this tutorial - https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app downloaded the project files and opened the Xcode project from the 'Completed' folder.
When I run the app using the iOS scheme and select the paired simulator, I only see the iPhone simulator coming up. If I run the watch target, I only know the watch simulator and no iPhone simulator. I went ahead and unchecked "Supports running without iOS App Installation" from Watch Target -> General -> Deployment target and even after that I am just seeing the watch simulator getting displayed. I want to see both iPhone and watch side by side.
Please let me know how can I do this on Xcode 13.2.1. Below are some pics.
Apple watch tutorial (source - https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app)
Open the simulator applications from your macOS applications, use the mouse options menu on the icon in the dock, and select -> device -> watchOS, you can start your paired watch simulator from there.

Prevent Xcode from preparing Apple Watch when running for iOS

I have an iOS app that I want to test on my personal iOS device. I also wear an Apple Watch that's connected normally to this iPhone.
I have not knowingly created any kind of Apple Watch target or code in my Xcode project. I do not want to run or test the app on my Apple Watch. I have not set up the Apple Watch as some kind of development target in Xcode... it's just connected to my iPhone.
Despite this, Xcode continually tries to ready my Apple Watch for development alongside the iPhone. It delays running the iOS app on the iPhone so that it can "prepare" and "fetch" various things from the Watch. These spinners never end and as a result I am unable to deploy the iOS app to the iPhone.
iPhone is busy: Preparing Apple Watch for development via iPhone
Xcode will continue when iPhone is finished.
iPhone is busy: Fetching debug symbols for Apple Watch paired to iPhone
Fetching debug symbols for the watch
Installing Symbols for watchOS 7.4
Apple Watch via iPhone: Failed to prepare device for development.
This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.
How can I fully hide this Apple Watch from being seen by Xcode? Disable any kind of development on the Watch? Deploy the iOS app to the iPhone without involving the connected Apple Watch at all?
I'm not interested in "fixing" the errors and warnings... I want the Apple Watch to not be used at all by Xcode.
Found this workaround, worked for me.
Unplug iPhone
Switch flight mode on the Watch
Switch off Bluetooth on the Watch
Plug the iPhone back in and build
Good luck!
https://developer.apple.com/forums/thread/691452?answerId=704424022#704424022
Additionally, make sure you've updated Xcode to a version that supports your iOS/watchOS version (proper SDKs) - I've found this to be necessary to avoid the interminable 'preparing...' phase.
For me just turning off Wifi and Bluetooth on the phone worked. So follow the below steps:
Stop the Xcode project
Turn off WIFI and Bluetooth on your phone only
Run the Xcode project
If you've installed Xcode from Mac App Store, I've experienced a few cases where Xcode just won't update. (and it says "no update" even if you check for update from the app menu)
Solution: login to your Apple Developer account, then click this link.
https://developer.apple.com/download/all/?q=Xcode
Download the latest version of Xcode .xip file (as of today Xcode 13.3.xip) then move the file to /Applications.
Delete current install of Xcode, then double-click the .xip just downloaded to install it.
It should then work and continue to receive future updates.
Just powering off the watch, unplug/replug device, and restart Xcode worked for me!

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.

Xcode 7.1 iOS 9.0 watchOS 2 app stops running after install

When I run my watch kit app (WatchOS 2) in Xcode 7, Swift, it installs and then finishes (stops). No error messages, it just stops. I've uninstalled and re-install both the IOS app and the watch app. No luck. Runs fine in the simulator. If I create a new empty project, same behavior. When I check the watch app on the watch, the new build is installed. It just doesn't run from Xcode so I can't get my debug messages. I am using the scheme for the IOS app and the Watch App. Is there anything to look for in the scheme config? I have also recently updated my provisioning profile and development certificates.
I've tried looking at similar questions, but so far they have not helped.
Xcode successfully builds my target, but does not run the product
Debug/Run in Xcode stopped working. Executable settings are wrong and can't be fixed too
and similar to:
"This app contains an app extension with an illegal bundle identifier" issue
There's several people with this problem. I can't give you any tips for iOS 9.0 and XCode 7.1 (Besides, reseting everything and trying again). But, If you update to watchOS 2.1, iOS 9.2 and XCode 7.2, everything works.
With device connected, shut downing my iPhone and watch and then restarting fixes the problem.

xcode installs app on iphone but does not run in Xcode

Ive added a new device (iPhone 5s) to test my app using xCode 5.0.2. The app installs onto the phone without running in Xcode.
When you select the play button on Xcode, the app builds successfully and installs the app. If you open the app on the iphone it works well - when you close the app on the iPhone, Xcode crashes !!!!
Its kind of working as neat way of getting the app onto a device without load time - but I need to see my logs in Xcode as the app is running on my device.
you need to make sure that you keep the device connected to the computer and thus Xcode while running the app, any NSLog you have or error you get will show up

Resources