How to display debugger message when in wait for executable to be launched

Hi, I am trying to debug when user is receiving remote notitifcation and I would like to debug the code in app delegate file with the mode of wait for executable to be launched. I did not see any debugger message or print message in the console. I have an extra target which is Notification Service extension, just to provide as many information as I can. Please help. thank you!

Replies

Xcode can only see printed output if it launched your program; if your program was launched by the system and then Xcode attached after the fact, it can’t see such output.

When debugging problems like this your best option is to:

  • Log with a dedicated logging API

  • View your log entries using the Mac’s Console app

With regards APIs, your best option is the unified logging system (

<os/log.h>
in C-based languages,
os.log
in Swift). This allows you to tag your log entries so that you can more easily find them in Console. It also helps with in-the-field debugging because your log entries are captured by a sysdiagnose logs.

You can learn more about unified logging in WWDC 2016 Session 721 Unified Logging and Activity Tracing.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"