简体   繁体   English

WatchKit App仅启动iPhone模拟器和WatchKit应用程序,但不启动IOS应用程序

[英]WatchKit App only starts iPhone Simulator and WatchKit App, but not the IOS App

I have configured the WatchKit App to run on iPhone 6, the WatchKit App Scheme Executable points to WatchKit App.app, Watch interface points to Main, but the IOS App is not starting only the WatchKit App. 我已将WatchKit App配置为在iPhone 6上运行,WatchKit App Scheme Executable指向WatchKit App.app,Watch界面指向Main,但IOS App并未启动WatchKit App。

When I select the WatchKit App to run on iPhone 6, the iPhone 6 simulator is starting, I see a black screen for a second after that the simulator returns to IOS level but the main app is not starting, only the WatchKit App on the Apple Watch simulator. 当我选择WatchKit应用程序在iPhone 6上运行时,iPhone 6模拟器正在启动,我看到一个黑屏一秒后模拟器返回到IOS级但主应用程序没有启动,只有Apple上的WatchKit应用程序观看模拟器。 I can not figure out why the IOS App is not starting? 我无法弄清楚为什么IOS App没有启动?

In order to debug the iOS app while running the Watch Extension, you should follow the steps explained here . 要在运行Watch Extension时调试iOS应用程序,您应该按照此处说明的步骤操作。

You also need to understand that the iOS App does not have to be running while the Watch app is running. 您还需要了解在Watch应用程序运行时不必运行iOS应用程序。 You have several combinations of possible runtime scenarios...all of which your iOS app and Watch App must handle seamlessly. 您有几种可能的运行时方案组合......所有这些都是您的iOS应用和Watch App必须无缝处理的。

  • iOS App is running but not the Watch App iOS App正在运行但不是Watch App
  • Watch App is running but not the iOS App Watch App正在运行但不是iOS App
  • Both apps are running in the foreground 这两个应用程序都在前台运行
  • Watch App is running in the foreground and iOS App is running in the background Watch App在前台运行,iOS App在后台运行

I have also posted some additional information about launching the parent app from the Watch Extension as well as sharing data here . 我还发布了一些有关从Watch Extension启动父应用程序以及在此处共享数据的其他信息

Hopefully that helps. 希望这会有所帮助。

There is a bug at the moment which hasn't been fixed yet. 目前还有一个尚未修复的错误。 To get around and launch the iPhone app do the following: 要绕过并启动iPhone应用程序,请执行以下操作:

1) Stop any process in Xcode. 1)停止Xcode中的任何进程。

2) Build and run the iPhone app. 2)构建并运行iPhone应用程序。

3) Stop the iPhone app once launched. 3)启动后停止iPhone应用程序。

4) Switch to the WatchKit scheme extension and build and run it. 4)切换到WatchKit方案扩展并构建并运行它。

5) Open your iOS app from the iPhone home screen by pressing its icon. 5)按下iPhone图标,从iPhone主屏幕打开iOS应用程序。

If you want to see NSLogs from the container app, you can do this: 如果要从容器应用程序中查看NSLog,可以执行以下操作:

  • put a breakpoint as early in your watch app's processes as possible 尽可能早地在手表应用程序的过程中设置断点
  • run the container app 运行容器应用程序
  • stop the container app 停止容器应用程序
  • run the watch app and let it hit the breakpoint 运行手表应用程序让它打到断点
  • with the watch app running and debugging connected, go to the simulator and open the container app by clicking on it 随着手表应用程序运行和调试连接,转到模拟器并通过单击打开容器应用程序
  • go back to XCode and go to Debug > Attach to process > Your container app 返回XCode并转到Debug> Attach to process> Your container app

You should now be connected to both processes, and see breakpoints and logs from both. 您现在应该连接到两个进程,并查看两个进程的断点和日志。 You can use the thread navigator in the left pane to switch between apps (which you'll need to do to get the watch app running again). 您可以使用左侧窗格中的线程导航器在应用程序之间切换(您需要执行此操作才能使监视应用程序再次运行)。

Note that an early breakpoint in the watch app is optional, I just find it useful to make sure any early breakpoints are caught. 请注意,监视应用程序中的早期断点是可选的,我发现确保捕获任何早期断点很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM