How to debug your iOS extension

This is Part 5 of our tutorial on how to have your AIR app be shown in the iOS 8 Share Menu.

The source code for this tutorial, complete with build scriptsis available here.

Time

5-7 minutes

Wait, have you done this first?

To do this part of the tutorial you will need an iOS Extension created in Xcode. If you don’t have one, the previous parts of this tutorial will show you how to create it (the meat is in Part 2):

Alternatively, you can download the source code for the tutorial here.

Step 1: Got a native app?

Remember how in Part 2 of this tutorial you first had to create a native app project in Xcode, in order to be able to add an iOS Extension target?

I found it helpful to first test things out with that app, before replicating functionality in my AIR app. You can run the app on your iOS device directly from Xcode: make sure your device is selected in the top-right and then click the Play button:

run your app in the Xcode debugger

You can also set up your Xcode project to run your AIR app, instead of the fake native app. We show you how to do that in the iOS Native Extensions Debugging Guide companion to our eBook Easy Native Extensions.

Step 2: Attach the debugger to your extension process

You may not need to run the app first before you can debug your extension, but keep it in mind, in case the next option is disabled in the Debug menu.

Back in Xcode select Debug > Attach to Process > By Process Identifier (PID) or Name…

attach the Xcode debugger to your iOS extension process

In the dialog that appears put your iOS Extension name as the Process Name:

put the iOS extension name as Process Name

When you click Attach, you will see this message at the very top bar of Xcode: it’s waiting for your iOS extension to start:

the debugger is waiting for the iOS extension to launch

If you are debugging a Share Extension such as the one we created in the previous parts of this tutorial, you can start it by selecting to share a photo with your app on your iOS device:

your AIR app in the iOS 8 Share Menu

The debugger should detect your extension and the message at the top should now read: Running… :

the debugger is running the iOS extension

You can now set breakpoints in your Xcode project and see what’s going on:

breakpoint in Xcode

 

The source code for this tutorial, complete with build scriptsis available here.
Opt In Image
Early bird offer on the ANE eBooks

 

Buy any Easy Native Extensions 2nd Edition package and get our $99 iOS + Android ANE Template completely free before the end of June 2015.

 

 

  • step-by-step guide to making your iOS extension in under an hour
  • library for data conversion between ActionScript and native code
  • tutorials
  • infographics
  • code included

Warning: count(): Parameter must be an array or an object that implements Countable in /home/easyna6/public_html/easynativeextensions_wp/wp-includes/class-wp-comment-query.php on line 399

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">