How to Build an Adobe Air Application for Mac OS AppStore
- From the sandbox
- Tutorial
A search on the Internet did not give a result, although it would be more correct to say only a partial result was given. I hope this instruction helps you. If you are interested, welcome to cat. Attention many letters.
First you need to get two certificates from Apple:
- Installer Certificate - INSTALLER_CERTIFICATE
- Application Certificate - APPLICATION_CERTIFICATE
Instructions on how to get certificates are easily google.
After receiving the certificates, they must be registered in the system.
All actions must be performed on Mac OS.
The next step is to build your application, for this you can use Flash Builder 4.7 with Adobe Air SDK 3.6 or the utility from Adobe Air SDK 3.6 “ADT”. At the assembly stage, it does not matter what certificate you sign your application with, certificates from Apple you can not sign the application.
As a result, you should get a file like bundle.app - in fact, it’s just an archive with the files of your application and c air runtime. You will need to install Xcode, to be more precise, some of its utilities.
Let's create a folder somewhere and name it e.g. build. We put our ready-made bundle.app there.
Now you need to prepare the icons for your application from the requirements for the icons - this is the presence of all sizes and file names.
We create a folder in build with the name icons.iconset inside, we should put such files (the name of the files must necessarily be just that):
- icon_16x16.png - size 16x16
- icon_16x16@2x.png - size 32x32
- icon_32x32.png - size 32x32
- icon_32x32@2x.png - size 64x64
- icon_128x128.png - size 128x128
- icon_128x128@2x.png - size 256x256
- icon_256x256.png - size 256x256
- icon_256x256@2x.png - size 512x512
- icon_512x512.png - size 512x512
- icon_512x512@2x.png - size 1024x1024
Do not ask why the same icons with different file names are used, according to Apple's userguide, if there isn’t at least one file, AppLoader will not let you through.
We go to the build folder using the Terminal (from the console) and enter the command:
iconutil -c icns "icons.iconset/"
as a result, we get the icons.icns file and copy it to bundle.app/Contents/Resources using the command:
cp icons.icns bundle.app/Contents/Resources/
remove the webkit from the application that is prohibited from Apple (they say it uses private API): we
rm bundle.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/Current/Resources/WebKit.dylib
give full rights to the folder with the application:
chmod -R 777 bundle.app/
edit the file bundle.app/Contents/Info.plist it should look like this for you:
CFBundleAllowMixedLocalizations CFBundlePackageType APPL CFBundleInfoDictionaryVersion 6.0 LSMinimumSystemVersion 10.6 LSRequiresCarbon CFBundleIconFile icons.icns CFBundleIdentifier com.sitename.bundle LSApplicationCategoryType public.app-category.puzzle-games CFBundleGetInfoString 1.0.0, CFBundleShortVersionString 1.0.0 NSHumanReadableCopyright CFBundleExecutable Fatty Maze NSHighResolutionCapable CFBundleLocalizations en ru zh
I’ll clarify one point, in Info.plist it is necessary to indicate in which category your application will be placed, this is done here:
LSApplicationCategoryType public.app-category.puzzle-games
the category name is strictly regulated, the list of categories can be found here.
We again go to the build folder through the Terminal and start directly signing the application certificate and all its components with the following commands:
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/AdobeCP15.plugin
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/Flash\ Player.plugin/
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/adobecp.plugin
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app
Instead of APPLICATION_CERTIFICATE you should enter the full name of your certificate, it looks something like this for me “3rd Party Mac Developer Application: Vasya Pupkin " quotation marks are required.
The next step is to add support for the sandbox. Create the file entitlements.plist in the build folder with the contents:
com.apple.security.app-sandbox
add changes to the application and sign it with a certificate using the command from the terminal being in the build folder :
codesign -f -v -s --entitlements entitlements.plist bundle.app/
to make sure that everything is done correctly: as a
codesign --display --entitlements - bundle.app
result, you should see the contents of your entitlements.plist , if there is no content in the output, then you did something wrong right.
And finally, product build :
productbuild --component bundle.app /Applications bundleInstaller.pkg --sign INSTALLER_CERTIFICATE
My INSTALLER_CERTIFICATE looks something like this: “3rd Party Mac Developer Installer: Vasya Pupkin” quotation marks are required.
We check whether everything is correctly signed:
sudo installer -store -pkg bundleInstaller.pkg -target /
If the percentage reaches 100 and you did not see any errors, Congratulations, it means everything is done correctly and can be sent to the app.
PS We created a game for iOS on Adobe Air and ported it with minor changes for MacOS, now our application is being tested in MacOS.
I do not specifically indicate the names and links of the application, this is still not a PR article.
All manipulations were obtained from these sources and these methods:
- http://pigsels.com/2012/04/air-app-store-publishing-guide/
- http://forums.adobe.com/message/4564789#4564789
- The method of scientific poking.
- Error messages received from Apple (some error descriptions are full, to the impossibility - Status: Invalid Binary. And go see why!)
UPD:
there were some changes when building the application with Adobe air 3.8.
These commands are no longer needed: (not necessary) (not necessary) (does not work) but instead of these three lines one: Thank you for the new information pozirk
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/adobecp.plugin
codesign -f -v -s APPLICATION_CERTIFICATE bundle.app
codesign -f -v -s --entitlements entitlements.plist bundle.app/
codesign -f -v -s APPLICATION_CERTIFICATE --entitlements entitlements.plist bundle.app/