With Adobe AIR 3.3, support for native iOS simulator would be available for application development.
Prior to this feature, the only way to test AIR applications on iOS was to have an actual device along with a developer certificate from Apple. With simulator support now available however, there is no need to obtain a developer certificate (which is a time consuming process) or to create a provisioning profile before starting to develop an AIR application. A p12 certificate, which can be created by the developer himself would be sufficient.
Native simulator for iOS is very helpful in testing and debugging AIR applications. Because support for this enhancement is currently not available in Flash tooling, one could use the following adt commands below to use this feature .
Simulator for iOS is based on x86 architecture and therefore two new targets have been added in ADT to support the same.
Targets are:
1.) ipa-test-interpreter-simulator
2.) ipa-debug-interpreter-simulator.
To package application for simulator in any of the above targets, execute either of the following commands:
Test Interpreter Target
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 Simulator SDK >
eg. /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
Debug Interpreter Target
adt -package
-target ipa-debug-interpreter-simulator
-connect
-storetype pkcs12 -keystore Certificates.p12 -storepass password
Sample_ipa_name sample_ipa-app.xml sample_ipa.swf
-platformsdk <path to Simulator SDK >
If you observe carefully, you will find that for debug target I have not specified any IP address . This is so because simulator will always be launched on the local machine and therefore there is no need to specify an IP address.
Also note that it is essential to provide the -platformsdk switch and the path to the external iOS simulator SDK, while packaging an application for the Simulator, as the runtime doesn’t contain the required binaries for the Simulator.
Now if you have packaged your application, it is time to install it by executing the command given below:
To install application in simulator
adt -installApp -platform ios
-platformsdk (path to sdk)
-device ios-simulator
-package sample_ipa_name.ipa
NOTE: This feature doesn’t work well with Xcode 4.3.2 . The problem arises because the latest version of Xcode is installed as a .app and this feature requires mobile framework to be there in /developer directory. As a workaround you would need to install an older version of Xcode too or wait for the release version of AIR.
After installing the application, try to launch and run it on Simulator using the command given below:
To launch application in simulator
adt -launchApp
-platform ios
-platformsdk (path to sdk)
-device ios-simulator
-appid Sample_ipa_name
The application can be uninstalled from the simulator directly through UI or if you want to uninstall it using command line then use the command below.
To uninstall application in simulator
adt -uninstallApp
-platform ios
-platformsdk (path to sdk)
-device ios-simulator
-appid Sample_ipa_name
NOTE: if you uninstalled the application using ADT command then application will get purged but its icon still keeps on showing on simulator . It will goes away once you restart the simulator.
Native Extensions and Simulator
I have already mentioned above that simulator on iOS is based on x86 architecture. To support native extension on simulator, a new platform name (iPhone-x86) has been added in extension.xml. All the commands to mention ane are similar to that with device, so I am not mentioning the commands for packaging. However, please note that for packaging native extension library.a file required from XCode should be compiled for simulator target . A typical extension.xml for simulator ane would look like below:
<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>

Pingback: วิธีการใช้ iOS Simulator ใน Adobe AIR 3.3 | FlexBlog on HTML5, PhoneGap, and Flash Platform!
thanks for your sharing…
but I have a problem … when I want to test interpreter target with ANE file:
adt -package -target ipa-test-interpreter-simulator -storetype pkcs12 -keystore ~/Desktop/Certificates.p12 -storepass passwd ANETest ANETest-app.xml ANETest.swf -extdir ane_dir
I get an error msg:
SDK: ${env.AIR_PATH_TO_SIMULATOR_SDK} not found. Use -platformsdk option while packaging.
then …
adt -package -target ipa-test-interpreter-simulator -storetype pkcs12 -keystore ~/Desktop/Certificates.p12 -storepass passwd ANETest ANETest-app.xml ANETest.swf -extdir ane_dir -platformsdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/
I get other error msg:
ld: file not found: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/../../usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a
Compilation failed while executing : ld64
but libgcc.a exist in there…
if you have any idea to solve this problem … please let me know … thx!
Hi Starck,
Are you using latest labs build . If not ,can you try it with the latest Adobe AIR 3.3 beta build ? thanks!
Please also verify that you are using the ane file created for Simulator target . If not please compiled your libxyz.a file for Simulator target and repackage ane before using
Thanks !!
sorry, I know my reply is late.
yes, I’m using latest labs build.
I solve this problem …
the directory doesn’t exist… “i686-apple-darwin10″ on my Mac mini ( MacOS 10.7.4 )
but I have “i686-apple-darwin11″ directory
so I create a symbolic link
ln -s i686-apple-darwin11 i686-apple-darwin10
then it work.
thanks!
I’m having the same problem as Starck, I get the error:
ld: file not found: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/../../usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a
trying to package an AIR app with native extension for the simulator. This is with AirSDK 3.3 alpha 3. I will try the simlink hack for now, but it would be nice to not have to do that with the final AIR SDK.
“NOTE: This feature doesn’t work well with Xcode 4.3.2 . The problem arises because the latest version of Xcode is installed as a .app and this feature requires mobile framework to be there in /developer directory. As a workaround you would need to install an older version of Xcode too or wait for the release version of AIR.”
Is it still the case with SDK 3.3 beta 3 with iOS 5.1 ? Because I can’t seem to find why the following command doesn’t work given the path the SDK is correct, yet I get “SDK should point to a valid path”:
/Applications/Adobe/sdks/AIR3.3b3/bin/adt -installApp -platform ios -platformsdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -device ios-simulator -package /path/to/my/application.ipa
@Cecile : Hi you are using wrong sdk path it should be iPhoneSimulator.platform and not iPhoneOS.platform .
@Stark: “ld file not” issue would be fixed in the Release build
-thanks
Ashish Gangwar
@gangwar Ahhh thanks
I posted the completed script on Github if that can help others who will come accross this post: https://gist.github.com/2821841
Pingback: Native Extensions with Flash CS6 | LancelotMobile.com
I made an FDT template to compile AIR using the new Simulator supported features, this may be of use to anyone who uses Eclipse and FDT to compile their apps on a MAC – http://theboywhocriedwoolf.com/air-3-3-simulator-support-usb-debugging/
External assets aren’t visible in the iOS simulator, it works fine when I test on the iPad. Am I doing something wrong here?
Jamie, what kind of assets are they? Could you please share some more details?
Im getting following error and can not figure out why:
SDK is missing GPL component /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/../../../../../usr/llvm-gcc-4.2/lib/gcc/
IAm testing on iOS5.0 simulator with air 3.3, any ideas ?
EDIT: Found the problem, i had missed one last folder.
so the path would look like ( osx 10.7 & iosSDK 5.x ): /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
Note that in new iOS sdk, there is no more /Developer/… folder, instead everything is held in one package, that means inside xCode.app
apt -launchApp reports “Application is not installed” however when I return apt -installApp it reports “Application is already installed”.
When I manually open the iOS Simulator and can see the app is indeed installed but named MyAppName-debug so have tried apt -launchApp MyAppName-debug but get the same “Application is not installed” message.
Any ideas?
Hey Alastair, remember that the ‘launchApp’, like ‘uninstall’ doesn’t take the package name, it takes the appid. When FB is compiling to IPA, it would change the app name, in your case, to MyAppName-debug, but the *id* would be something like MyAppName.debug.
Check in your xml descriptor file, it’s whatever is in the node is used for “uninstall” and “launchApp”, the ipa name is used when you’re compiling to an ipa, and when you’re launching the app after it’s installed.
Hi seaders,
I’ve tried using the app id and the name – both report the same problem. When I install the app, it reports the app is already installed. When I launch the app, it reports its not installed and when I try to uninstall the app, the same thing – Application is not install. I’m giving up hope here!