问题描述
我有一个已发布的iOS应用,我正在尝试为其添加 WatchKit
扩展程序。
I have a published iOS app and am trying to add a WatchKit
extension for it.
目前,我所拥有的只是一个 interface.storyboard
,只有一个标签
只是为了验证整个构建过程。该应用程序在模拟器(iPhone 6(8.3))和Watch模拟器上运行良好。
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.
当我在iPhone和Apple Watch上运行时,它在iPhone上运行,安装在Apple Watch上,但在尝试运行它时只显示等待状态在Apple Watch上。
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.
Xcode中的错误表示等待附加,当我尝试通过 Xcode>附加它时调试>附加到流程
,它说丢失与iPhone的连接。
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".
我正在使用Xcode 6.3.1。
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:
- 首先构建主iPhone应用程序,然后停止并构建WatchKit应用程序
- 等待一段时间让附件完成(可能需要20秒左右)
- 我发现点击Apple Watch上的应用程序图标有时会对重新建立丢失的连接。点击应用程序图标后,应用程序通常会开始更新。因此,在显示消息
等待附加
后,点击您的Apple Watch应用程序。 - 如果等待没有帮助,请停止所有进程(make确保Xcode中的停止按钮变为灰色,然后再次构建并运行代码
- 有时,重新启动Xcode有助于解决问题
- 强制 - 退出Apple Watch上的应用程序,如
- 如果仍然没有帮助,请使用iPhone上的
Apple Watch
应用程序卸载并重新安装WatchKit扩展程序
- 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:
- 清理您的项目
- 使用iPhone上的
Apple Watch
应用程序卸载并重新安装您的手表应用程序 - 从设备删除iPhone应用程序
- 删除/重新创建目标方案
- 在WatchKit应用目标设置中,将Skip Install设置为NO
- 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
这篇关于为什么我的WatchKit扩展程序会导致“等待附加”实际Apple Watch上的消息但不是模拟器中的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!