While the answers that mention activating "Wait for executable to be launched" are good in theory, for various reasons these didn't work for me. On the simulator, though Xcode claimed it had "attached", no logs or breakpoints were ever shown. On-device I was running iOS 13, building from Xcode 10, and using Xcode 11 to load, so I didn't have any debugging symbols. That was more of a personal problem, I suspect on device debugging may have worked.
What worked best for me was just opening up Console.app on my mac, and using the OSLog
APIs to get a solid stream of caveman debugging from the simulator.
- Run the app from Xcode on the simulator.
- Then immediately quit it on the simulator via the app launched (Cmd-Shift-H * 2)
- Launch the app by tapping a deep link I sent to myself via the Messages app
- Observe my logs in Console.app
It's not pretty, but it is highly reliable.
It's also worth mentioning, that you can protect this useful feature by testing cold start deep-linking via XCUITest. You can call app.terminate
in your XCUITests, then open a deep link (typically via a static web page you've setup, I use public GitHub wikis for this) and write tests and assert behaviors just like normal.
xcrun simctl openurl booted http://yourdomain/path
to launch the app with the URL we want. – Horsefaced