简体   繁体   中英

Debugging the iOS part of Apple Watch app in the Simulator

A couple of years ago I wrote and debugged an Apple Watch app using the watchOS 1 SDK. I am now working on a new watch App using the watchOS 3 SDK.

The Watch App part is able to be debugged. I can set break points and step through it. However, I use the WatchConnectivity framework to get information from the iOS app. This isn't working and I'm unable to debug it.

When I run the WatchApp scheme in Xcode, two simulators get launched, one for the iOS app and one for the WatchApp. I see the WatchApp starting but not the iOS app. If the iOS was previously running, it appears to be killed.

I put a break point on the application:didFinishLaunchingWithOptions: in the iOS app, method but this break point is never hit. Should it be.

I don't recall having these problems a couple of years ago when going through this.

Should running the WatchApp scheme automatically start the iOS app and allow it to be debugged? Should my didFinishLaunchingWithOptions: breakpoint get hit?

The other thing that is sort of strange and may be hint is that the External Displays list in the iOS simulator never shows watch app displays. I would think it should.

I've tried cleaning the project, restarting Xcode and even rebooting my computer. No joy.

No, the iOS and WatchApp have different targets, so running one from Xcode doesn't start the other one automatically.

You have to start one of them using Xcode in the usual way, then start the other app manually from its respective Simulator, than in Xcode use Debug>Attach to Process to see both apps in the debugger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM