且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS9 共享扩展无法在 Xcode 上调试

更新时间:2023-02-02 10:34:38

通常,您可以通过转到调试"->附加到进程或 PID"并输入共享扩展的名称来调试共享扩展.从那里你可以在你的设备或模拟器上打开共享扩展,Xcode 的调试器应该正确地附加和命中断点.但是,我注意到执行此操作时不会显示日志消息,也不会为调试器视图中的变量填充值.

Typically you can debug a share extension by going to Debug -> Attach to process or PID and entering the name of your share extension. From there you can open the share extension on your device or simulator and Xcode's debugger should attach and hit breakpoints correctly. However, I've noticed that log messages do not show up when doing this, nor do values populate for variables in the debugger view.

这是我如何让调试正常工作.运行共享扩展方案.当它询问您要运行什么应用程序时,选择照片"(因为这是您的扩展程序将在其中运行的应用程序).然后照片应用程序将在您的设备上启动,您可以继续使用您的扩展程序.Xcode 中的调试器应该会按预期工作.

Here's how I got the debugging to work correctly. Run the share extension scheme. When it asks you what app to run, chose 'Photos' (because that's the app your extension will operate in). The Photos app will then launch on your device and you may proceed to use your extension. The debugger in Xcode should then work as expected.