How to debug XPC services in Xcode 4?

I added the XPC service to my project, and I would like to set breakpoints and check the contents of the variable in the debug area in Xcode. The breakpoints that I set in the service code are not recognized (obviously, the debugger is connected to the main application process. How do I attach the debugger (manually or automatically) to the XPC service process after starting my main application? A way to start the service myself and send its messages without running it from the main application?

+4
source share
2 answers

Debugging → Bind to process → Process identifier (PID) or name ...

Enter the name of the XPC service process. The next time launchd launches your XPC service, Xcode will attach.

+7
source

I'm not really sure how to connect a debugger. But you can use "NSLog" to output debugging to the console. Then run "Console.app" in "/Applications/Utilities/Concole.app". Depending on your system language, this application may have a different name (it is localized). It displays ALL NSLog output from all running applications, including your xpc services.

This is not a debugger, but you will receive information from your service.

+2
source

Source: https://habr.com/ru/post/1265386/


All Articles