AppsDev
AppsDev

Reputation: 12499

WatchKit: direct communication with the containing iOS app

I just get started with WatchKit and I'm trying to do this (if I'm not wrong, it is possible to do): I'd like the WatchKit Extension to ask the containing app for requesting some data to a web service, and then return the service response to the Extension to update the WatchKit App interface accordingly.

As I read in Apple Watch Programming Guide, yo can call the openParentApplication:reply: method in the WatchKit Extension to request something to its containing app, and then the application:handleWatchKitExtensionRequest:reply: method in the AppDelegate of the containing app should be called. Once this method called, I need to perform the service request, wait for its response, and then send it back to the Extension.

However, when I run the WatchKit App scheme in the simulator, the openParentApplication:reply: method is called, but a breakpoint within the application:handleWatchKitExtensionRequest:reply: is not reached. So I'm not even able to test if I can correctly perform the web service request and get its response back.

What could I be missing? Should I configure somehow the schema to reach breakpoints in the containing app as well? Is it needed to declare some kind of background feature for this?

Thanks in advance

Upvotes: 2

Views: 1392

Answers (1)

cnoon
cnoon

Reputation: 16643

I just answered a very similar question here which will allow you to open the iOS app from the Watch Extension and getting a reply back.

In order to debug the iOS app while running the Watch Extension, you should follow the steps explained here.

Upvotes: 3

Related Questions