Reputation: 470
I set up a test target for my Watchkit extension by following the steps mentioned in the 'How can I unit test my WatchKit extension?' section in this link.
Then I imported a controller class from the Extension into my test class and tried to create an object for it. This is throwing a EXC_BAD_ACCESS error.
Import statement:
#import "NotificationController.h"
Creating an object:
NotificationController *controller = [[NotificationController alloc] init];
The controller class i imported is a sub class of WKUserNotificationInterfaceController. Could someone tell me what I am doing wrong?
Thanks!
Upvotes: 3
Views: 371
Reputation: 5939
This post from Pivotal Labs says they hit a similar issue. http://pivotallabs.com/watchkit-test-tools-pivotalcorekit/
It sounds like using WatchKit classes directly (as you are, even with a subclass) doesn't work. Perhaps try breaking your code out into a separate, testable class and including that in your WKInterfaceController
classes.
Upvotes: 2