问题
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.
回答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 attach
appears. - 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 Watch
app on your iPhone
Other things you could try:
- Clean your project
- Uninstall and re-install your watch app using the
Apple Watch
app 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
回答2:
I discovered that my WatchKit Bundle Names in my info.plist were not consistent. Ensure that the prefixes are exactly correct.
回答3:
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)
回答4:
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
回答5:
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
回答6:
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.
来源:https://stackoverflow.com/questions/30180716/why-does-my-watchkit-extension-cause-a-waiting-to-attach-message-on-an-actual