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);
}
My main app(iPhone app) for iPhone doesn't get run on the simulator.
This is basically what I see.
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.
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):
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.
I had a similar issue. Here is a couple of things you can try (solved it for me)
- make sure you app, watchkitapp and watchkitextension have the same bundle id e.g. com.company.app for the app and com.company.app.watchapp for the watchkit app. I have several build configs with different bundle ids, so xcode took the wrong one during watch target creation. You'll get a compiler error if app's and extension's are different, but watchapp bundle id will not create an error.
- first run of the app, before you open the watch in the external devices menu will hit all the breakpoints and logs but you'll see nothing after you open the watch simulator.
- a couple of times the app got stuck on launch for me - in debug navigator the state was 'waiting to attach'. had to reset the simulator every time after that.
Hope it helps.
This might not be your problem, but it was mine.
If you include a table in your watch app, you need to implement the methods in the InterfaceController in order for anything to show up. You cannot just put a table in, and then put a label in the first row, and then have it show up (like you would with a static UITableViewController).
Follow this guide for adding tables: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/Tables.html#//apple_ref/doc/uid/TP40014969-CH14-SW1
Oh man. This one really stumped me. I was working on something in Beta 1 and had a table row which was a subclass of WKInterfaceController. In Beta 5 all I saw was the same blank table view and when calling
[self.interfaceTable rowControllerAtIndex:x]
it was returning nil.
Solution: Switched my row to be a subclass of NSObject and it worked fine!
Just change the scheme to AppName WatchKit App and build.