Tom Krcha's FlashRealtime

Hey amigo!
I am Tom Krcha, Gaming Evangelist at Adobe. These are my notes

Upcoming E-Seminars: Develop Flash based iOS Apps and Games with Adobe AIR 3.3

June 14th, 2012

Adobe will be running a series of online seminars on iOS development using Adobe AIR in June, July and August. Great chance to learn the best practices and ask questions.

Get your e-seat here.

Check it out, the time is always:

10:00 AM - 11:00 AM US/Pacific, San Francisco
1:00 PM - 2:00 PM New York
6:00 PM - 7:00 PM London, Lisbon
7:00 PM - 8:00 PM CET, Barcelona, Paris, Berlin, Prague, Vienna
8:00 PM - 9:00 PM Kiev, Bucarest, Athens, Tel-Aviv
9:00 PM - 10:00 PM Moscow, Dubai

AIR For iOS - Build Your First iOS App - “Hello World” Session ›
Thursday, June 21, 2012

AIR For iOS - Features, Capabilities, and Limitations ›
Thursday, June 28, 2012

AIR For iOS - Measuring performance – Instruments and Monocle ›
Thursday, July 12, 2012

Build Your First iOS Native Extension With Adobe AIR ›
Thursday, July 19, 2012

Debugging AIR Native Extension For iOS ›
Thursday, July 26, 2012

AIR 3.3 - New Graphics Features ›
Thursday, August 2, 2012

Using USB debugging with AIR 3.3 for iOS

June 9th, 2012

With AIR 3.3 there is a useful feature coming - USB debugging on iOS. (Note: This feature is already available with AIR for Android.) Previously you could debug over WiFi on iOS, but now USB debugging is available and it is way more comfortable to use.

This feature is not yet available in Flash Builder, but will be in the future. If you want to use it now, follow the steps below with the command line:

To debug an AIR for iOS app, you have to use three different commands: adt (compilation), idb (port forwarding) and fdb (debugger)

1) Compile the application
Compile with ipa-debug or ipa-debug-interpreter and include the -listen [port] switch (I am using the default port 7936) file

PATH_TO_AdobeAIR33_SDK/bin/adt -package
-target ipa-debug-interpreter -listen 7936
-provisioning-profile PROFILE.mobileprovision
-keystore CERTIFICATE.p12 -storetype PKCS12
-storepass PASSWORD FINALAPP.ipa DESCRIPTOR-app.xml APP.swf

2) Install the application on an iOS device
I am using command-line installation on Mac, but you can use iPhone Configuration Utility, iTunes or Xcode Organizer to install .IPA file on an iOS device. Find out more about IPA installation here.

Run this at the command line; it will transfer an iOS app (IPA) to the device:

./transporter_chief.rb ./APP.ipa

Your command-line should look like this:

3) Open the application on an iOS device

You should see this screen:

4) Launch the FDB debugger

The FDB command is part of Flex SDK, which is usually located here: “/Applications/Adobe Flash Builder 4.6/sdks/4.6.0/bin/fdb”

Execute the following command in command-line; the port we are going to use for this is 7936:

/Applications/Adobe Flash Builder 4.6/sdks/4.6.0/bin/fdb -p 7936

Once it opens, type run, hit enter and you should see this:

5) Forward ports with the IDB command
As a part of the AIR 3.3 SDK, you can find the idb command at AIR33SDK/lib/aot/idb/idb
It tells you what devices are connected and it allows you to forward ports and establish communication between the debugger and the device. Switch to the AIR33SDK/lib/aot/idb/ folder and run:

./idb -devices

You should see something like this:

List of attached devices
Handle UUID
14 2348920341abe904922030938292234

The number 14 is important in this case. Remember it and initiate port forwarding by launching:

./idb -forward 7936 7936 14

6) Debug with the FDB debugger
Now go back to the Terminal screen where you have FDB running and type continue. You should see trace calls coming in to the terminal windows. Of course you can set breakpoints and so on, for more information see the FDB documentation.

In the debugger you should see this:

tomkrcha$ ./fdb -p 7936
Adobe fdb (Flash Player Debugger) [build 23201]
Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.
(fdb) run
Trying to connect to Player
Player connected; session starting.
Set breakpoints and then type ‘continue’ to resume the session.
[SWF] SimpleiOSDebug.swf - 1,393 bytes after decompression
(fdb) continue

The application I used was very simple, here is the code:

	import flash.display.Sprite;
	public class SimpleiOSDebug extends Sprite
		public function SimpleiOSDebug()
			stage.addEventListener(MouseEvent.CLICK, onClick);
		protected function onClick(event:MouseEvent):void
			trace("HELLO DEBUGGER");

Run your Flash apps in Xcode iOS Simulator with AIR 3.3

June 9th, 2012

AIR 3.3 adds a new feature to preview and debug your apps directly in iOS Simulator, which is part of Xcode on Mac. This speeds up testing and preview of an app or a game especially when you use native extensions.

[Download AIR 3.3 SDK]
[ADT command documentation]

Simulator support is not yet part of Flash Builder, but you can already use it via the command-line:

Compile for iOS Simulator
There are two new options available with adt for iOS Simulator compilation:
1) ipa-test-interpreter-simulator (for testing)
2) ipa-debug-interpreter-simulator (for debugging)

PATH_TO_AIR33SDK/bin/adt -package
-target ipa-test-interpreter-simulator
-provisioning-profile DEMO.mobileprovision
-keystore CERTIFICATE.p12
-storetype PKCS12

The command in on Mac:

Install to iOS Simulator
In order to install app to iOS Simulator use the -installApp switch. See usage below:

PATH_TO_AIR33SDK/bin/adt -installApp
-platform ios
-platformsdk /Applications/
-device ios-simulator
-package FINALIPA.ipa

Launch app in iOS Simulator
To launch the app, there is the -launchApp switch used together with the -appid.

PATH_TO_AIR33SDK/bin/adt -launchApp
-platform ios
-platformsdk /Applications/
-device ios-simulator
-appid com.krcha.IDofMyApplication

Uninstall app from iOS Simulator
Use the -uninstallApp switch. See below:

PATH_TO_AIR33SDK/bin/adt -uninstallApp
-platform ios
-platformsdk /Applications/
-device ios-simulator
-package com.krcha.IDofMyApplication

In the real world, it’s good to put the commands above in separate .sh or .bat files. You can also combine them into a single command to run your app even faster; for example:

Important note: in order to make native extensions run properly in iOS Simulator, you have to compile them with iPhone-x86 settings, not iPhone-ARM.
In extension.xml change the platform name

<platform name=”iPhone-x86″>

Waste Invaders running in the iOS Simulator.