Getting black screen on Watchkit simulator and "Waiting to Attach" when adding to existing project - ios

I'm interested in adding a Watchkit Extension to my existing app already in the app store. I've done my research, followed some tutorials, and now am ready to actually implement.
The problem I'm having is, I can't seem to add a Watchkit App to my existing project and get it to run in the simulator. If I start a new project and do some tutorials or whatever, the Watchkit App runs fine. Adding to my existing project, I just get a black screen in the simulator window. Not even the status bar is present. http://i.imgur.com/kG7H06i.png
Only lead I have so far is: In the debug navigator, I get "Waiting to Attach" every time I try and launch the app. http://i.imgur.com/vYLfJN8.png
Any help on this would be appreciated. I reseting my simulators, tried deleting my simulators and then reinstalling. Double checked that bundle identifiers and versions match. Target for the WatchKit App and Extension are both set to 8.2 (I was getting an error setting to 8.3). Target on the main app is 6.0, but I tried bumping this up to 8.2 and had the same results.
Thanks!
EDIT: Before this is marked as a duplicate of How to run a WatchKit App, I do want to mention that I'm running the "Watchkit App" Scheme, and I do not have a status bar like in the window like he does.

Are you using iOS 8.2 simulator ?
I had similar error, switching to simulator with iOS 8.3 fixed it for me.

Check that your build target is the Watchkit App. I had it set to the main app so the main app was launching in the sim, but the watch app was blank.
referenced here.
How to run a WatchKit App

I am also running into a similar problem but not on the simulator but on the Apple Watch device. Try setting Skip Install to NO in the WatchKit App target settings

After working with Apple, it appears as if this was an issue with Xcode creating the target. Our app is several years old, and for some reason when creating any new target, the Wrapper Extension is set to "app" every time. This has caused us issues in the past with trying to add testing targets as well.
We were able to fix the issue by going to the Watchkit Extension target, and changing the Wrapper Extension from "app" to "appex". Make sure you leave the Watchkit App target to "app". We asked why Xcode wasn't doing this automatically for this particular project, and it's because the overall project target has the Wrapper Extension set. If you create a new project, you'll notice that Xcode now leaves this blank.
Hope this helps someone else.

Sometimes, restarting Xcode solves the problem.
Even if everything is configured correctly, it may take 20 seconds to attach the process to the debugger.

I tried everything but nothing helped. Then I backed up the watch app and watch extension folders. After that I removed the watch app and watch extension targets and created new targets. Then I restored the files from the backup. It's an awkward approach but it solved the "waiting to attach" problem.

Xcode 10.0; Swift 4.2; iOS 12.0
I had the same issue with Apple Watch simulator. What actually solved it was deleting the default Siri watch face from the Watch App on the iPhone simulator.

Related

Apple Watch App Extension won't run on the simulator anymore

I'm creating my first Apple Watch app and upon first adding the Watch and Watch extension targets I was able to start building my interface and running on the simulator. Since then I've needed to update my iOS app while still working on the Watch app. So I used this advice to "disable" my watch app so I could submit a build for the new iOS version:
Prevent deploying (disable) WatchKit App with iOS iPhone App in Xcode
Simply, by removing the watch and extension in target dependencies and embedded watch content in Build Phases did the trick. Now I'm picking back up the work I put down but can't seem to get it to run on the simulator. I add back the target dependencies and the embedded watch content but I get the error: Error Launching 'App Name Extension' Invalid Bundle - No Apple Watch Binary
Can anyone explain what that means and why I am getting this error?
For anyone who comes across this problem seeking an answer. I found that I had been changing my version and build number to accommodate my current iPhone version and build number. This was creating that error, so to fix it I left the watch app and extension app version/build as default 1.0 and 1.

Why does my WatchKit extension cause a "Waiting to attach" message on an actual Apple Watch but not in a simulator?

I have a published iOS app and am trying to add a WatchKit extension for it.
For now, all I have is a watch interface.storyboard with a single label just to verify the entire building process. The app runs fine on the simulator (iPhone 6 (8.3)) and the Watch simulator.
When I run it on the iPhone and Apple Watch, it runs on the iPhone, installs on the Apple Watch, but then just displays a wait status when trying to run it on the Apple Watch.
The error in Xcode says "Waiting to attach", and when I try to attach it via Xcode > Debug > Attach to Process, it says "Lost connection to iPhone".
I am using Xcode 6.3.1.
The Waiting to attach message is bothering many people. Here are a few things that you can do:
Build the main iPhone app first, then stop it and build the WatchKit app
Wait some time for the attachment to finish (it can take 20 seconds or so)
I found that tapping the app icon on the Apple Watch sometimes helps to re-establish a lost connection. After tapping the app icon, the app often starts to update. So tap on your Apple Watch app after the message Waiting to attachappears.
If waiting does not help, stop all processes (make sure that the stop button in Xcode becomes gray) and then build and run your code again
Sometimes, restarting Xcode helps to solve problems
Force-quit your app on the Apple Watch as explained here
If that still does not help, deinstall and reinstall your WatchKit extension using the Apple Watchapp on your iPhone
Other things you could try:
Clean your project
Uninstall and re-install your watch app using the Apple Watchapp on your iPhone
Delete your iPhone app from the device
Delete/recreate the target scheme
In the WatchKit app target settings, set "Skip Install" to NO
I discovered that my WatchKit Bundle Names in my info.plist were not consistent. Ensure that the prefixes are exactly correct.
It was really never working for me.
I was able to fix it to remove any specific architectures in the build settings of the app target and leave it to Automatic (remove ARCHS = ... in project file)
Restarting the watch solved this for me.
Press and Hold the side button until you see the Power Off Slider.
Drag the slider to turn off your device completely. (Note it is NOT a button to press)
After you turn off your Apple Watch, press and hold the side button again until you see the Apple logo.
From this Apple Support Page: https://support.apple.com/en-gb/HT204510
I was developing a findersync extension for Mac and faced similar issue with XCode 7.2.1 and i found my changing bundle identifier of the extension project, it fixes the issue. I know this is not a permanent solution but atleast it will help you keep going forward if nothing else works
I have the same issue I have already two watch apps in the App Store but the current project with only some Interface objects runs fine in simulator but not on the watch I get only the waiting symbol and then it switch back to the apps screen on the watch.
I found the issue it was a setting of the Build architecture in the build setting. I used Xcode automatic problem solver to change the old project.
Now it works fine.

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.

Impossible to run my Apple Watch application in iOS Simulator

I'm trying to run an Apple WatchKit target with my Universal app, using Xcode 6.2
I'm probably doing something wrong, but I can't access to the simulator in the scheme menu
Any idea ?
Have you tried to attach it in the iOS simulator?
This appears to be a bug that at times affects some Build Schemes for some reason. Fortunately, it is easy to fix.
In the menu that appears in your screenshot, select "New Scheme".
Select your WatchKit App as the target, and give it a name. Click 'OK'.
In the new entry in the Schemes menu, you should now be able to open your WatchKit app in the simulator.
You can also correct this issue via "Manage Schemes" and removing and re-adding your existing WatchKit App.
No luck?
For those who are still having a headache after doing this list of things:
Creating new schemes
Hacking Targeted Device Family
Autocreating schemes
Clearing Derived Data and Module Cache cleaning Project
Restarting Xcode, Mac
History
It took me about 3 hours to get rid of no targets (my case was My Mac target), I copied the project somewhere to keep my current data and I did these things to inspect:
Deleting current targets (AppExtension and WatchKit)
Creating them again (for my surprise the iOS Simulator this time came up)
Opening Product->Scheme->Edit Scheme
Selecting a scheme which target is WatchKit App
Under Build I see that my old scheme had only its own target (WatchKit one) while the new that was generated from new targets had 3 targets (MainApp, WatchKit and WatchExtension)
I did the same thing to my old ones by adding target, and the simulator came up, ran it and worked perfectly
Solution
Open Product->Scheme->Edit Scheme
Select your WatchKit Scheme
Select Build and if you see only one target, that could be the case, add the other required target (in my case were MainApp and WatchKit Extension)
If it works, cheers :)
Hope it helps somebody
This is likely the issue reported in the Xcode Release Notes whereby Xcode can't communicate with the simulator service if you rename Xcode.app. Please reboot your system.
Renaming Xcode.app after running any of the Xcode tools in that bundle
may cause iOS Simulator to be no longer be available. Either rename
Xcode.app back to what it was when first launched or restart your Mac.
(16646772)
If you open the Watch Kit project in lower versions of Xcode (6.1 and below) you wont get the simulator options.
Not sure if you have done the same, but I just observed this today.

Application Data bundles in Xcode 6. Always crashes or shows error

How do you correctly use Application Data bundles in Xcode 6? I exported a .xcappdata file from a device, added it to my workspace, and selected it in the Run Options of a scheme.
Whenever I try to run the simulator with iOS 8.0, I get the following error, even on repeated launches, manual launches, etc:
Application data package not copied to the Simulator
It appears you are running 'REDACTED.app' on the iPad Air Simulator for
the first time, and therefore do not yet have a data folder created.
The application data package will be installed the next time you run
your app in the Simulator.
Trying to use the simulator with iOS 7.1 crashes Xcode.
Does this feature just not work anymore with the changes made to the filesystem?
Tried again on Xcode Version 6.1.1 (6A2008a) and it (sometimes) crashes Xcode now, hopefully that means it will be get fixed soon...
I'm using Xcode 8.1 and when I tried to add the .xcappdata file Xcode crashed.
I solved it by cleaning the app and then I tried to add it in another target and it worked. Afterwards I tried to put it again in the target I wanted it in and it worked as well.
Unfortunately I'm not sure about which of these steps fixed it but I hope it to be useful to someone!
You can try to clean the Derived Data which contains all the intermediate build information like debug- and release-built targets. And you probably can select the Simulator, choose the iOS Simulator from the menu. Then, choose Reset Content and Setting.
Sometimes, it's just some bugs in the XCode. And I think Apple is handling that when your issue is marked by duplicate by them.

Resources