2

I've followed the documentation that Apple provides for debugging extensions and I'm still unable to debug an extension, so for example, breakpoints are not being picked up.

I've created a new target for the extension, that created a new scheme and I've configured that scheme to launch the correct app when running my extension.

The extension works fine but debug things like NSLog or breakpoints are not working. I also tried answers like this but they are not working

I'm using Xcode 6 beta 5 and iOS simulator

Community
  • 1
  • 1
estemendoza
  • 3,023
  • 5
  • 31
  • 51
  • I struggled a lot and finally got it working with my answer here: http://stackoverflow.com/questions/33870693/ios9-share-extension-can-not-debug-on-xcode/39443906#39443906 – GPRyan Sep 12 '16 at 05:40

1 Answers1

6

In addition to this answer https://stackoverflow.com/a/24043265/1136433 which says how to view logs of the extension app, in that log you can also check the PID of the extension.

Let's say you have the following NSLog statement:

NSLog(@"Testing");

Execute the extension and in the system.log you will see something like this:

Sep 11 11:13:40 my_machine.local today[5689]: Testing

Where 'today' is the name of the extension you are executing (in my case was a Today Extension) and the '5689' is the extension PID.

So, now you can go to Xcode -> Debug -> Attach to Process and then you can set breakpoints and debug the code.

Hope this can help somebody

Community
  • 1
  • 1
estemendoza
  • 3,023
  • 5
  • 31
  • 51
  • might wanna add the @ before "Testing" – CW0007007 Nov 28 '14 at 10:17
  • How can I get the system.log ? – EnriMR Jan 15 '16 at 15:44
  • @EnriMR I am not having this issue anymore with Xcode 7, seems Apple fixed this issue. You just now choose the extension on the targets list and execute it, and Xcode will automatically attach to the extension process (be aware that sometimes this fails, try a couple of times until it succeed) – estemendoza Jan 16 '16 at 13:25
  • @estemendoza I'm using Xcode 7.2 and I have the bug :( – EnriMR Jan 18 '16 at 09:54
  • @EnriMR weird, try a couple of more times just in case. System.log can be displayed with "console" app, just open spotlight and search for console – estemendoza Jan 18 '16 at 13:25