I have read a few questions/answers before asking, and also attached process, but does not seem to work.
My watchkit extension is written in Swift, and the AppDelegate is in Objective-C (since it is old code).
In my extension, I called:
@IBAction func toPage2() {
println("to page 2")
WKInterfaceController.openParentApplication(["page":"2"], reply: {(reply, error) -> Void in })
}
In my AppDelegate, I tried printing
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply
{
NSLog(@"handle watchkit");
NSString *file = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"page2"] ofType:@"wav"];
AVAudioPlayer *audio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:file] error:nil];
[audio play];
...
I have also tried Debug > Attach to process and choose the iPhone app, and still nothing happened. Can anyone points me to a direction?