Debug System Pref Pane w/10.11 and System Integrity Protection

末鹿安然 提交于 2021-01-27 05:14:25

问题


One of my projects is a System Preference Pane. With 10.11, Xcode's debugger can't debug it as I get a "can't attach to System Preferences because of System Integrity Protection".

How can I debug my prefpane under 10.11, as I have done in every OS back to 10.3?


回答1:


I ended up making a copy of System Preferences, called it "System Preferences (Signed)" and then signed it with my DeveloperID which replaces the old code signature and allows it to run normally without SIP getting in the way.




回答2:


After creating your PreferencePane project edit the build scheme, select the Run scheme on the left list and on the argument tab add an environment variable using + button (variable OBJC_DISABLE_GC and value YES).

Then choose Pre-Actions on the left list and add

cp -Rf ${CONFIGURATION_BUILD_DIR}/BuildOutputPrefPane.prefPane ~/Library/PreferencePanes

Then choose Run on the left list and choose the System Preference.app as Executable from the info tab.

Build your solution and go to build output and install your Preference Pane by clicking on it and replace existing one.

Run you project with the right scheme now if you put a breakpoint in you app and use the installed Preference Pane it works, logging work too.

This work for Swift too.

Tested with Xcode 7.1.1, EL Capitan and Swift 2 language. Enjoy



来源:https://stackoverflow.com/questions/32854006/debug-system-pref-pane-w-10-11-and-system-integrity-protection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!