Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Apple watch app on actual device?

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 {

enter image description here

Suggested solution by Jesse Tayler gives this error:

enter image description here

like image 546
user1872384 Avatar asked May 22 '15 09:05

user1872384


People also ask

How do I debug iOS app on real phone?

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.

How do I debug my Apple Watch with Xcode?

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.

How do I view Apple Watch logs?

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.


2 Answers

use the -> Debug -> Attach to process... menu and you'll be able to debug

like image 196
Jesse Tayler Avatar answered Oct 12 '22 02:10

Jesse Tayler


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.

like image 26
Rajesh Rajendran Pillai Avatar answered Oct 12 '22 00:10

Rajesh Rajendran Pillai