xcode 苹果手表模拟器问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27201559/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:16:57  来源:igfitidea点击:

Apple watch simulator issue

iosxcodewatchkitapple-watch

提问by NSAnant

I am trying to debug and run the app on apple watch simulator. I have tried by using different target for notification, Glance and Watch app but apple simulator don't shows any thing.. It stuck in waiting for attach process of extension. I just see a black screen for the Apple Watch Simulator.

我正在尝试在 Apple Watch 模拟器上调试和运行该应用程序。我尝试使用不同的目标进行通知、Glance 和 Watch 应用程序,但苹果模拟器没有显示任何内容..它一直在等待扩展的附加过程。我只看到 Apple Watch Simulator 的黑屏。

What did I do wrong?

我做错了什么?

How to overcome this issue ?

如何克服这个问题?

enter image description here

在此处输入图片说明

采纳答案by zisoft

I had the same issue. The only thing that helped was to delete and recreate the target scheme.

我遇到过同样的问题。唯一有帮助的是删除并重新创建目标方案。

回答by Lizza

Thispost from the dev forums solved my issue. More specifically, this excerpt:

来自开发论坛的这篇帖子解决了我的问题。更具体地说,这段摘录:

  • In order for Watch apps to function properly, certain properties must match across the Watch app and its App Extension (18857540):
  • The WKAppBundleIdentifier property of NSExtensionAttributes in the WatchKit App Extension's Info.plist must match the CFBundleIdentifier of WatchKit App's Info.plist.
  • The WKCompanionAppBundleIdentifier property of the WatchKit App's Info.plist must match the CFBundleIdentifier of the Containing iOS App's Info.plist.
  • 为了使 Watch 应用程序正常运行,Watch 应用程序及其应用程序扩展中的某些属性必须匹配 (18857540):
  • WatchKit App Extension 的 Info.plist 中 NSExtensionAttributes 的 WKAppBundleIdentifier 属性必须与 WatchKit App 的 Info.plist 的 CFBundleIdentifier 匹配。
  • WatchKit App 的 Info.plist 的 WKCompanionAppBundleIdentifier 属性必须与 Containing iOS App 的 Info.plist 的 CFBundleIdentifier 匹配。

回答by Vince Yuan

I have exactly same problem. I created a new project and added WatchKit extension in Xcode 6.2 beta 4 with WatchKit. I tried all ways mentioned in other answers but still failed to let watch app run in the simulator. Finally, I made it work.

我有完全相同的问题。我创建了一个新项目并使用 WatchKit 在 Xcode 6.2 beta 4 中添加了 WatchKit 扩展。我尝试了其他答案中提到的所有方法,但仍然无法让手表应用程序在模拟器中运行。最后,我让它工作了。

My steps:

我的步骤:

  1. Delete the containing app in the iPhone simulator.
  2. Clean your project in Xcode.
  3. Do not run the containing app, run the WatchKit app from Xcode.
  1. 删除 iPhone 模拟器中包含的应用程序。
  2. 在 Xcode 中清理您的项目。
  3. 不要运行包含的应用程序,从 Xcode 运行 WatchKit 应用程序。

回答by vomako

Before spending a lot of time on changing things, restart Xcode. Sometimes, this solves the problem.

在花费大量时间进行更改之前,请重新启动 Xcode。有时,这可以解决问题。

Even if everything is configured correctly, it may take 20 seconds to attach the process to the debugger.

即使一切配置正确,将进程附加到调试器也可能需要 20 秒。

回答by Tom Schurmans

I was experiencing the same issue. Mainly when creating an app extension in an existing app.

我遇到了同样的问题。主要是在现有应用程序中创建应用程序扩展时。

I was able to consistenly solve it by doing the following steps:

通过执行以下步骤,我能够始终如一地解决它:

  • Make sure that the app extension gets the .appex extension. XCode tends to set it to .app. You can do this under 'build settings' -> 'wrapper'.

  • Under the 'Build Phases' tab in your target, your app extension should be listed under 'Embed App Extensions'. If you don't see this section, you can enforce it by adding a normal app extension to your app (fe. action extension). The section will now be visible. Replace the dummy extension you just created with the Watch app extension.

  • 确保应用程序扩展名为 .appex 扩展名。XCode 倾向于将其设置为 .app。您可以在“构建设置”->“包装器”下执行此操作。

  • 在目标的“构建阶段”选项卡下,您的应用扩展应列在“嵌入应用扩展”下。如果您没有看到此部分,您可以通过向您的应用程序添加一个普通的应用程序扩展(fe. action extension)来强制执行它。该部分现在将可见。将您刚刚创建的虚拟扩展替换为 Watch 应用扩展。

Start the host app and then start the Watch app, it should be working now.

启动主机应用程序,然后启动 Watch 应用程序,它现在应该可以工作了。

回答by msk

You need to run the Watch App target and then from iPhone/iPad simulator check (Hardware -> External displays), any one of the Apple Watch options.

您需要运行 Watch App 目标,然后从 iPhone/iPad 模拟器检查(硬件 -> 外部显示器),任何一个 Apple Watch 选项。

回答by Cap

I had some trouble on iPhone 6 simulator, but each time I switch on iPhone5S it works.

我在 iPhone 6 模拟器上遇到了一些麻烦,但每次我打开 iPhone5S 时它都能工作。

回答by Ranza

In my case the trouble was caused by a scheme with missing target although not the one I was trying to run. Hope that helps somebody.

在我的情况下,问题是由缺少目标的方案引起的,尽管不是我试图运行的方案。希望对某人有所帮助。

回答by dk87

I was running into this problem as well and tried a few of the suggestions above. I found that deleting and recreating the target scheme resolved it. Everything is working fine now.

我也遇到了这个问题,并尝试了上面的一些建议。我发现删除并重新创建目标方案解决了它。现在一切正常。