本文介绍了如何在 XCode 4 中调试 XPC 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中添加了一个 XPC 服务,我想在 XCode 的调试区域中设置断点并检查变量内容.无法识别我在服务代码中设置的断点(显然,调试器附加到主应用程序进程.我的主应用程序启动后,如何将调试器(手动或自动)附加到 XPC 服务进程?是否有一些单独运行服务并向其发送消息而不从主应用程序启动的方法?

I added an XPC Service to my project and I would like to set breakpoints and inspect variable contents in the debug area in XCode. Breakpoints that I set in the service's code are not recognized (obviously, the debugger is attached to the main apps process. How and I attach the debugger (manually or automatically) to the XPC Service process after my main app launches it? Is there some way to run the service alone and send it messages without it being launched from the main app?

推荐答案

Debug -> Attach To Process -> By Process Identifier (PID) or Name...

Debug -> Attach To Process -> By Process Identifier (PID) or Name...

输入您的 XPC 服务进程名称.下次 launchd 启动您的 XPC 服务时,Xcode 将附加.

Type in your XPC service process name. The next time launchd starts up your XPC service, Xcode will attach.

这篇关于如何在 XCode 4 中调试 XPC 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 22:30