I want to debug both the apple watch app (foreground) and the iOS app (background)
The reason is because I'm using this code in Apple watch extension to open the iOS app in background to make a service call:
[WKInterfaceController openParentApplication:@{@"key":@"loadRecentData"} reply:^(NSDictionary *replyInfo, NSError *error) {...
And I want to set a breakpoint inside here to check if there's a reply:
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply {
Suggested solution by Jesse Tayler gives this error:
Plug your iPhone into your computer. You can select your device from the top of the list. Unlock your device and (⌘R) run the application. You'll see Xcode install the app and then attach the debugger.
Basically select the Watch App as the scheme in xcode, hit build+run which will build the iOS app and WatchKit app, install the WatchKit app on to the Watch and attach the debugger to the WatchKit Extension.
You can do it by installine sysdiagnose profile to Apple Watch. Add it to your iPhone and you will get the choice to choose "Apple Watch" to install it to. Once you install it and click "Done" then you will start seeing Apple Watch logs in Console.
use the -> Debug -> Attach to process... menu and you'll be able to debug
Select watchkit app from schemes. Run this in your " Paired iPhone + Watch ". Launch the app in watch. Now you can debug your code. I tried this and is working for me. I am using xcode 7.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With