如何运行WatchKit应用 [英] How to run a WatchKit App
问题描述
我无法从新项目中运行Watchkit应用.如果我运行Apple的示例项目,它将运行正常.如果我通过为watchkit添加目标将watchkit添加到我的现有项目中.然后运行它,即使在情节提要中我有一个设置为main且具有蓝色背景的界面控制器,时间也会黑屏.这行代码被调用.
I can't run a watchkit app from a new project. If I run Apple's sample project it runs fine. If I add watchkit to my existing project by adding a target for watchkit. Then run it I get a black screen with the time even though in my storyboard I have an interface controller that is set to main that has a blue background. This line of code gets called.
- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[self.listTable setNumberOfRows:5 withRowType:@"List"];
NSLog(@"%@ will activate", self);
}
我的iPhone主应用程序(iPhone应用程序)无法在模拟器上运行.
My main app(iPhone app) for iPhone doesn't get run on the simulator.
这基本上就是我所看到的.
This is basically what I see.
推荐答案
运行时,您是否将方案更改为WatchKit App目标? 还是您只是建立&照常运行iOS应用程序? 目前,您无法同时运行iOS应用程序目标和Watch App目标.
When you run, did you change the scheme to the WatchKit App target? Or did you just build & run the iOS app as usual? For now you can't run both the iOS app target and Watch App target at the same time.
您必须按照此处所示的方式切换方案/目标,然后选择相同的模拟器&显示已经完成的手表UI,(在模拟器中->硬件"选项卡->外部显示器-> Apple Watch):
You have to switch schemes/targets as shown here, then pick the same simulator & display the watch UI as you've already done, (in the simulator -> "Hardware" tab -> External Display -> Apple Watch):
您还必须添加/编辑方案以查看情节提要的Glance或Notification部分. 有关更多详细信息,请参见示例Lister项目中的自述文件".
You also have to add/edit schemes to view the Glance or Notification parts of the storyboard. See the "Readme" file in the sample Lister project for more details.
这篇关于如何运行WatchKit应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!