简体   繁体   English

如何调试ios8共享扩展名?

[英]How to debug ios8 share extension?

I tried two ways to debug while the extension is running: 在扩展程序运行时,我尝试了两种调试方法:

a. 一种。 using NSlog, such as 使用NSlog,例如

    NSLog(@"%@", ((NSExtensionItem *)self.extensionContext.inputItems.firstObject).userInfo);

but no log shows. 但没有日志显示。

b. using code like 使用类似的代码

    p self.extensionContext

in the lldb debug mode, but it tells me 在lldb调试模式下,但它告诉我

    error: property 'extensionContext' not found on object of type 'ShareViewController *'
    error: 1 errors parsing expression

You need to use simulator debug. 您需要使用模拟器调试。 On Simulator, click on Debug Menu, Open System Log. 在模拟器上,单击调试菜单,打开系统日志。

As mentioned HERE , you can debug share extension by attaching target 如前所述这里 ,你可以通过将目标调试份额扩展

Debug -> Attach Process -> By process name or PID 调试->附加进程->按进程名称或PID

在此处输入图片说明

In our case, PID will be Share extension bundle name as mentioned in Share Extension Target. 在我们的情况下,PID将是“共享扩展目标”中提到的共享扩展捆绑名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM