Flash and the Mac App Store

When the Mac App Store launched in January 2011, it included one app built with Flash. it was my game Gold Strike. I won’t go into the history of the game, which started with Flash 5, and then evolved into Director/Shockwave, and then back to Flash CS5 to become an iPhone app. But it was that last iPhone app version, done in CS5 that became the Mac App.
So the first thing I did was to make sure that I could export from Flash CS5 and get a decent application as a Flash projector. So I changed Publish Settings to export only a Macintosh projector and tested. I had to make a few adjustments, especially when you consider that the projector window can be stretched and scaled. But after a bit I got the projector working the way I wanted.
Now the hard work begins. You really have to do a lot to this projector file, a .app file, to get something that you can submit to the store. All of it pretty much has to be done on a Mac. I’m also assuming you are already signed up with a Mac Developer program. Oh, and read this entire thing first, don’t follow it as a step-by-step or you will be in trouble. You’ll see.
To do a lot of the changes, you need to get into the .app file. Control+click the file and select Show Package Contents. Now you can see the guts of the .app file.
Look in Contents/Resources for the icon.icns file. This is where you need to edit the icon. I used a program called Icon Composer that should be on your Mac as long as you have the Apple developer tools installed.
Next, you need to look at the Contents/Info.plist file. Edit that in BBEdit or something like it. It is just a text file. You need to make a number of changes in there. Refer to the document at the Mac Developer Center titled “Submitting to the Mac App Store.” This lists the plist items you need to be concerned about. Though it wouldn’t hurt to also look through the others and make changes where you think they might be necessary — copyright statements and such. Make sure you change CFBundleName to your applications’ name.
Now the Mac App Store doesn’t allow apps unless they are Intel-only. The App Store itself is only for Snow Leopard, which is Intel-only anyway. To get rid of the old PowerPC code in the .app file you need to launch Terminal and navigate over to your .app file. Change its name to something else to make room for the new copy you are about to create. Then use:
/usr/bin/ditto --rsrc --arch i386 YourAppName Copy.app YourAppName.app
Now test again to make sure it still works. You’ll notice the file size is much smaller now without all that PowerPC code.
Next you need to sign the app. You should have worked your way through the Mac Developer site to create a record for your app and for yourself as a developer. In the end you should get two certificates that would be neatly tucked away inside your Mac keychain. Lots about this on the developer site, so I won’t go into detail.
First, sign the app with your application certificate.
codesign -f -s "3rd Party Mac Developer Application: Your Name" -v YourAppName.app
The result is some message about the certificate being replaced. It is a very odd message, but the result is that it worked.
Now, you need to build an installer.
/usr/bin/productbuild --component YourAppName.app /Applications --sign "3rd Party Mac Developer Installer: Your Name" YourAppName.pkg
A common mistake here is to use the same certificate for each one. But you have to use your app certificate for codesign and your installer certificate for productbuild.
Now you have to test your installer. You can’t just double-click it to run the installer. You need to keep using the Terminal.
sudo installer -store -pkg YourAppName.pkg -target /
When you do this the first time, you will be puzzled because the app doesn’t appear in your Applications folder. The installer notices that it is still there, in your development folder, so it doesn’t bother to install it. Very annoying. You can move and rename it as you want, but the installer still won’t work. I had to end up compressing it into a .zip file, and then the installer couldn’t find it and would do a proper install to the Applications folder.
So that’s it. You now have a package file that you can upload to Apple. Except, no it isn’t.
So far, this is what I did to submit Gold Strike 1.0 to the app store. And somehow it got through. But there are several problems with this method that I had to clean up before I got version 1.0.1 through.
The main one is that the projector commits a huge sin: it uses a private API. That’s a big no-no for the App Store.
Now there is not much, or anything, you can do about this. This is deep inside the projector and you can’t remove it or rename it even with a binary editor. Try, and you just get an app that crashes.
So the solution is to not use Flash CS5. You’ve got to use Flash CS3 to build the projector. You see, I told you not to follow this as a step-by-step.
So you need to save copy of the .fla from CS5 as a CS4 file. Then from CS4 to CS3. (Note that going to CS4 might work too, but I don’t have CS4 installed anywhere to test).
Now, using CS3 you publish the projector. Then repeat all the steps above. The result is an app that does not use any private APIs.
But you are still not done. When you run the projector you get “About Adobe Flash Player 9″ as the first menu item in the application menu. This is also a sinsthat Apple will not allow. But there is no way to change them using Flash.
So you have to break out a binary editor and go to town. I used 0xED (http://www.suavetech.com/0xed/0xed.html). Look in Contents/Resources/Flash Player.rsrc. You’ve got to change the About menu item name. It takes some detective work to find it. Then, the important thing is to replace each character with a character. Overwrtie, don’t insert. Don’t delete any. So you may have to pad your name with extra spaces.
I also found the information that appears in the About box. I don’t know if that is important to Apple or not, but I changed it just to be safe.
Now codesign and built the package again. That should do it.
But of course the rules are always changing. So by the time you read this things might be different.
I don’t have any plans to use this process again as there are just too many places where things can go wrong. I hope, instead, that Adobe improves the projector publishing process. For starters, you should be able to set up an icon, set the about menu, choose Intel-only, and set all of the important items in the Info.plist file. Most importantly, of course, no private APIs.

February 11, 2011 • Posted in: General

14 Responses to “Flash and the Mac App Store”

  1. Fernando - February 11, 2011

    great article! you should send this to adobe somehow so they make the process easier! :p

  2. D - February 12, 2011

    Developers are always looking for ways to get their apps reviewed. This great site has paid apps for free but only for a limited time. They usually revert back to paid apps within 24 hours so it’s best to check back twice a day.
    The website is: http://www.appiology.com

  3. Atomi - February 14, 2011

    Wow, didnt know it would be “possible” even after so many steps and I surely hope that someone at Adobe reads and reacts about this
    Thanks for sharing your experience!

  4. ash - February 15, 2011

    Wow, crazy. I think I would rather avoid all the pain, bite the bullet, and learn Objective-C. Clever detective work nonetheless!

  5. Nana - March 9, 2011

    Can I use the same techniques to submit a Director projector?

  6. Zsolt Velykovits - July 17, 2011

    Hi Gary,

    First of all, thanks for your article about this topic. As far as I know it is the only guide about releasing flash projects to the Apple App Store.

    You mentioned it the projector calls a function from the private API.

    You can create projectors from the projector version of the flash player which is not connected to any version of Flash authoring app.

    Unfortunately I don’t know how to check that private API call, so I cannot check my theory, but I think that might solve this problem if you create the projector from the flash player and not from Flash CS5.

    What do you think of this solution?

    Cheers,
    Zsolt

  7. Yan Kitsis - September 19, 2011

    Gary,

    Is it possible to get some consultation from you?

    Yam

  8. Mantas - October 13, 2011

    Thank you very much, just have uploaded my first Flash based app to Mac AppStore. Your article was really useful, it took my whole day to figure out all the details, but finally I have my app waiting for a review :) I guess this is Just a first step to get into the AppStore. Thank you again.

  9. Harshad - October 17, 2011

    Good post.
    However with the release of AIR 3 I have a question –
    Now that we can get a captive run time in desktop apps similar to the iOS packager, do you think the process to get an app on Mac appstore become simpler?

  10. Andrew - December 2, 2011

    So how do i figure out if the projector uses a private API or not? Did a few google searches and I can’t understand anything about this API non-sense…

  11. Sara - December 23, 2011

    Hi, thanks for your great post!
    Maybe my question is so stupid, but I didn’t found any way to solve the problem.

    Using your terminal code line:

    /usr/bin/ditto –rsrc –arch i386 YourAppName Copy.app YourAppName.app

    I replaced “YourAppName.app” with my App Name (without complete path) and it didn’t work… so I wrote it with the complete path too.. but the result was null… why the terminal is still giving me this error ?:
    ditto: can’t get real path for source

    PLEASE, HELP!

  12. Danika - December 31, 2011

    This article was exactly what I was looking for. I tried getting help from Adobe, but even the developer technical support seemed to have no idea what I was talking about. I’m using CS4 and after I stripped the ppc code with the terminal command, the app made it to “Waiting for Review.” You didn’t say whether the problem with the private API was caught in the automated scan or in the manual review, but if it’s the automated scan I should be home free.

  13. Danika - December 31, 2011

    I guess I spoke to soon. When I try to run the app from the archive, it won’t initiate.

  14. Isuru - November 28, 2012

    Hi,

    i’m still inclear on how to remove that “about flash player” thingy

    Thanks

Comments are closed for this entry.