Posts in Category "Native Extensions"

Exception Support in iOS Native Extensions

Up to AIR 3.3, it was not possible to handle exceptions inside the Cocoatouch Static Library in an ANE. AIR 3.4 onwards, it is possible to use the Objective C @try-@catch-@finally syntax inside one’s native library. The native developer can now also use C++ try-catch blocks successfully. The only thing to keep in mind while using exceptions in native code on iOS is that the exceptions should be handled inside the ANE itself. The AIR runtime will not catch the exceptions thrown by extensions.

You can download the latest AIR SDK with support for handling exceptions in a Native Extension  from  http://labs.adobe.com/technologies/flashplatformruntimes/

AIR iOS app packaging with Flash Tooling and AIR 3.3

If you are using iOS Native Extensions with AIR 3.3, you may find that your application does not get packaged when using Flash Builder/Flash Pro. This is because, when using native extensions, linker warnings are not suppressed, and Flash Builder/Flash Pro are not able to handle such large number of warnings, specifically on Windows. This issue will be fixed in the upcoming release of Flash Builder and Flash Pro.

In order to overcome this issue, you can include the platform descriptor file (platform.xml) in your ANE, which contains the following linker option:

<option>-w</option>

A sample platform descriptor file will look like this:

<platform xmlns="http://ns.adobe.com/air/extension/3.1">
 <sdkVersion>5.0</sdkVersion> 
 <linkerOptions> 
 <option>-w</option> 
 </linkerOptions> 
</platform>

Then, at the time of packaging the ANE, include the ADT switch -platformoptions, providing the path to the platform descriptor file. For example,

Continue reading…

Commonly faced issues while developing Native Extensions for iOS

Developing  ‘Native Extensions for iOS’ requires knowledge of both native iOS code (C/C++/Objective C, XCode, static libraries etc) and AS3 code. So, it’s not unusual for developers to face issues. I have tried to list some of the most common roadblocks for native extension developers on this page.

1. extensionID

An extension is recognized by its extensionID. Thus, one should try to keep it as unique as possible, as an application developer might want to use more than 1 native extension in his application. Having the same name will create conflicts and the application won’t get packaged or work as expected.

a. Same extensionID should be used in the extension.xml, application.xml and the AS3 Class where ExtensionContext.createExtensionContext() function is called.

b. Using “nativeExtension” as the extensionID isn’t really a good idea. Prefixing the extensionID with com.developerName is probably the way to go.

Continue reading…