Requirements
Prerequisite knowledge
Previous experience building AIR apps for iOS will help you make the most of this article.
Required products
Adobe AIR
Additional required other products
Xcode
User level
Intermediate

Adobe AIR 3.3 includes support for the native iOS Simulator, providing a fast way to test and debug iOS apps. iOS Simulator is part of Apple's Xcode IDE for creating apps for Mac, iPhone, and iPad. To learn more about the iOS Simulator, see Using iOS Simulator. Prior to this feature, the only way to test AIR apps on iOS was with an actual device and a developer certificate from Apple. Now you can test and debug your AIR apps without obtaining a developer certificate (which can be a time consuming process) or creating a provisioning profile. A p12 certificate, which you can create and sign yourself is sufficient. Note that although you no longer need a developer certificate or provisioning file to test and debug, you do need still need them to deploy to iTunes. You may refer to this link to create a p12 certificate. A self signed certificate can also be created using Flash Builder, as described here. You may use the same self-signed certificate, as used for Desktop applications.
 

 
Packaging an application for the iOS Simulator

Support for the iOS Simulator is currently not available in Flash Builder, but you can access it from the command line using ADT.
 
The iOS Simulator is based on the x86 architecture and two new targets have been added in ADT to support it:
 
  • ipa-test-interpreter-simulator
  • ipa-debug-interpreter-simulator
To package an app for the iOS Simulator, execute ADT at the command line with –package and use –target to specify one of these targets. For example, for the test interpreter target you can execute the following:
 
adt -package -target ipa-test-interpreter-simulator -storetype pkcs12 -keystore Certificates.p12 -storepass password Sample_ipa_name sample_ipa-app.xml sample_ipa.swf -platformsdk <path to iOS Simulator SDK >
Note: Signing options are no longer required in case of simulators now, so any value can be provided in -keystore flag as it will not be honored by ADT.
 
An example path to the iOS Simulator SDK is /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
 
For the debug interpreter target, you can execute the following:
 
adt -package -target ipa-debug-interpreter-simulator -connect -storetype pkcs12 -keystore Certificate.p12 -storepass password Sample_ipa_name sample_ipa-app.xml sample_ipa.swf -platformsdk <path to iOS Simulator SDK>
Note that the command for the debug target does not specify an IP address. This is because the simulator will always be launched on the local machine, so no IP address is needed. You can find more information on test and debug targets here.
 
Also note that -platformsdk and the path to the external iOS Simulator SDK are always required when packaging an application for the iOS Simulator. You can find more information on using ADT here.
 

 
Installing and launching an application

Once you have packaged your application, you can install it in the iOS Simulator with ADT and –installApp ; for example:
 
adt -installApp -platform ios -platformsdk <path to iOS Simulator SDK> -device ios-simulator -package sample_ipa_name.ipa
After installing the app, you can launch and run it on the iOS Simulator using ADT and –launchApp ; for example:
 
adt -launchApp -platform ios -platformsdk <path to iOS Simulator SDK> -device ios-simulator -appid Sample_ipa_name
The appid value is specified in the application descriptor file (app.xml) within the <id> tag. Flash Builder uses the app name as the appid by default.
 
The application can be uninstalled from the iOS Simulator directly through the UI. Alternatively, you can uninstall it via the command line using –uninstallApp :
 
adt -uninstallApp -platform ios -platformsdk <path to iOS Simulator SDK> -device ios-simulator -appid Sample_ipa_name
Note: If you uninstall an application using ADT, its icon will remain in the iOS Simulator until you restart the simulator.
 

 
Testing native extensions in the iOS Simulator

When you want to test a native extension in the iOS Simulator, use the iPhone-x86 platform name in the extension.xml file and specify library.a (the static library) in th e nativeLibrary element. Be sure to use the static library (.a file) that is compiled for the simulator and not the static library that is compiled for the device.
 
Here is a typical extension.xml with these settings:
 
<extension xmlns=”http://ns.adobe.com/air/extension/3.1“> <id>com.cnative.extensions</id> <versionNumber>1</versionNumber> <platforms> <platform name=”iPhone-x86″> <applicationDeployment> <nativeLibrary>library.a</nativeLibrary> <initializer>TestNativeExtensionsInitializer</initializer> <finalizer>TestNativeExtensionsFinalizer</finalizer> </applicationDeployment> </platform> </platforms> </extension>
To package a native extension for iOS Simulator the ADT command would look like the following:
 
adt -package -target ane Sample_ane_name extension.xml -swc <path to SWC file> -platform iPhone-x86 library.a library.swf -platformoptions <path to platform descriptor file>
Here, -platformoptions is only required if additional linker options need to be specified.
 

 
Where to go from here

For more on AIR and mobile devices, see Developing AIR applications for mobile devices. To learn more about native extensions, see Native Extensions for AIR.