在 macOS 上除錯
為 Godot 編輯器進行除錯
將除錯器附加到已簽署的 macOS 程序時,需要啟用「com.apple.security.get-task-allow」授權。預設情況下不會啟用,因為只要該授權啟用,應用程式就無法進行公證。如果你想除錯官方版本的編輯器,必須使用正確的授權重新簽署。
建立一個 editor.entitlements 文字檔,內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
然後使用下列指令來重新簽署編輯器:
codesign -s - --deep --force --options=runtime --entitlements ./editor.entitlements ./path/to/Godot.app
除錯匯出的專案
若要允許除錯,請在匯出時選擇 codesign\debugging``(``com.apple.security.get-task-allow)授權。啟用此選項時,將不支援公證,因此應將其停用。