Reputation: 3527
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.
Upvotes: 8
Views: 8990
Reputation: 135
Upvotes: 0
Reputation: 471
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!
Upvotes: 0
Reputation: 8235
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
Upvotes: 3
Reputation: 235
I had a similar issue. Here is a couple of things you can try (solved it for me)
Hope it helps.
Upvotes: 4
Reputation: 3780
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.
Upvotes: 10