Submitting Bmax Apps to the Mac App Store

BlitzMax Forums/BlitzMax Tutorials/Submitting Bmax Apps to the Mac App Store

ima747(Posted 2011) [#1]
Note: I'm pending approval on my application at the moment, so I can't guarantee this satisfies all of apple's requirements, but it satisfies all the digital ones. Assuming the approval process is like iOS all that's left is conforming to all the design guidelines which is your responsibility... make it platform friendly, play by the rules (don't put stuff where it doesn't belong for example...) and you should be OK.

This guide assumes you have already completed all the setup in the developer center, installed your certificates, created an application bundle ID in the dev portal and prepared a submission in iTunes Connect, all you need to do is get your application from your computer to Apple and then cross your fingers...

Step 1: Prepare your Application
First you should have the latest version of xcode installed when you compile in bmax.

Now right or command click your program an select "Show Package Contents".

Update the icon file (Contents/Resources/*.icns) to include icons at every scale for your application (and also obviously not the bmax icon, but your own.) You can use Icon composer in the developer tools to create this file. It would be best if the icon file name doesn't contain spaces or special characters, not sure if this is a huge issue, but I just make mine match the application executable name (see next), update info.plist to match.

In your Application's contents ensure that your executable (the file in the MacOS folder) contains no special characters or SPACES in it's name. Modify your Info.plist to point the renamed executable if needed.

You must also ensure your info.plist contains a category entry pointing at the main category you are submitting for (see http://developer.apple.com/devcenter/mac/documents/submitting.html#//apple_ref/doc/uid/TP40010572-CH16-SW8 for details). You also must have a short version string (CFBundleShortVersionString, this should be something like "1.0" for your application's version number), copywrite (NSHumanReadableCopyright, this should be something like "2011 My Company, LLC."), icon file (CFBundleIconFile, "This should be the name of the icns file in the Resources folder WITHOUT the file extension,usually the same as the executable filename, such as "MyApplication") and bundle identifier (CFBundleIdentifier, this is the Identifier you created in the developer certificate utility, such as "com.mycompany.MyApplication").


Step 2: Signing
You must now code sign your app. Assuming your certs are installed correctly etc. this is quite easy.
Open a terminal window (with the terminal app in the applications/utilities directory)
Navigate to your application's directory. The easiest way is to just drag the application's folder from the finder onto the terminal window, this will auto enter the path, then just press return.
enter the following line, modifying as needed.
codesign -f -s "3rd Party Mac Developer Application: My Company, LLC" "My Application.app"

3rd Party Mac Developer Application: My Company, LLC - this is your application signing certificate's FULL name as it appears in the KeyChain. Open your keychain app and poke around to find it, it will start with "3rd Party Mac Developer Application". It must be in quotes as it contains spaces and other special characters.
My Application.app - This is the name of your application file. Mac applications are actually folders that end with a .app file extension. If it contains spaces or other special characters you must enclose it in quotes or otherwise escape them, it's easiest just to leave it in quotes no matter what, no harm.
If this goes well you should get no feedback, just a new line. If you have previously signed the application it will tell you it replaced the existing signature.
Don't close the terminal, we need it for the next step.

Step 3: Packaging
The mac app store requires you package your application in a signed pkg file as well to control how it will auto install. To create a signed package you will need to get the "Application Tools" from the Mac Dev Center (scroll down to App Store Resources when you are logged in, download and install). Assuming you have the tools installed enter the following on the command line and modify as needed
productbuild --component "My Application.app" /Applications --sign "3rd Party Mac Developer Installer: My Compnay, LLC" MyApplication.pkg

"My Application.app" - this is the name of the application file you signed in step 2, I'm unsure if you can use a folder (with other resources etc.) here or not, as I haven't needed to but I would assume you can.
/Applications - this is the location that your application will be installed. I believe this is currently limited to /Application and higher (such as /Applications/Utilities). Again, I haven't needed anything other than Applications so I haven't looked into it.
"3rd Party Mac Developer Installer: My Compnay, LLC" - The name of your INSTALLER certificate, just like the application cert in step 2, check the keychain for your exact name
MyApplication.pkg - the name of the package file it will create. It seems to reject spaces here as well, so best to stick with alpha-numeric only.

You should get feedback on the terminal along the lines of
productbuild: Adding component at /Volumes/Caduceus/Users/username/Documents/Dev Projects/My Application/My Application.app
productbuild: Signing product with identity "3rd Party Mac Developer Installer: My Company, LLC" from keychain /Volumes/Caduceus/Users/ima747/Library/Keychains/login.keychain
productbuild: Adding intermediate certificate "Apple Worldwide Developer Relations Certification Authority"
productbuild: Wrote product to MyApplication.pkg


You can test your installer puts things in the correct place by running it, or via the command line for automated install with
sudo installer -store -pkg MyApplication.pkg -target /


Step 4: Submission
Open the Application Loader program in /Developer/Applications/Utilites. Select the application from the drop down that you are going to submit. Select the package you just created and tested and hit send. It will perform some preliminary checks before sending it (for icon sizes etc.), and once submitted the server will do a few more checks. If Everything goes well you're all set! wait for apple to take a look. If you get any errors, correct them (google as needed) and re-sign, re-package, re-submit.


GfK(Posted 2011) [#2]
Good info, thanks. But:

You must now code sign your app. Assuming your certs are installed correctly etc. this is quite easy.


What certs? Where are they? What if they aren't installed correctly/at all?

It might be blindingly obvious but I don't fancy spending $99 or whatever it is, without knowing all the details beforehand!

Last edited 2011


jkrankie(Posted 2011) [#3]
The process for getting and installing certificates is detailed on Apple's developer site. It's not a big deal, you just use their online tool and the keychain app.

This is not the sort of thing that will ever be built into blitzmax, so you'll have to just get on and do it if you want to use the app store.

Cheers
Charlie

Last edited 2011


SLotman(Posted 2011) [#4]
Thanks for the detailed explanation...for sure it will save me (and others here) a lot of time!


ima747(Posted 2011) [#5]
Glad it's helpful :0)

Regarding the certs, as jkrankie noted, this is between you and apple and happens during the setup of your account.

Here's a rundown of the apple process for the uninitiated (rough from memory, I have multiple accounts for different things so your experience may vary.

Setup a developer account with apple. You can do this before hand, or during the purchase process of your Mac Developer license.
Purchase license with your account if you didn't make/buy at the same time. (you can tack it on to an existing iOS developer account for example).
Wait. Apple processes your purchase, validates you, charges you etc. and send you an email saying you're good to go (anywhere from a few minutes to a few days, possibly even longer if you're setting up a new account for a business and have to fax them some incorporation documents or other paperwork etc. this varies wildly depending on the type of developer account you set up and what exactly you're doing).
You now have an account. Login and through the dev center you can find links to get your developer certificates (application and installer run off different certs and you need both). They have simple step by step instructions on how to setup your certs and get them installed. Just go slow and it's easy.
You now have to create a bundle ID for your application. They walk you through this as well, it's simply a reverse domain style identifier used to tell your application apart from others (e.g. com.blitzmax.BlitzBasic for BlitzMax's BlitzBasic program...). You need to put this id in your info.plist so the system can track your app, issue updates, etc.
You are now set up to sign your applications, create installer packages, and generally get your code onto the store.
Head over to iTunes Connect and create a new application submission. You'll enter your app info, name, version, description, keywords, screen shots etc.
Once all of that is set and the application is listed as "Waiting for Binary" you can then use the application loader as described to upload (after following the tutorial to bundle it all up).
Then you sit back and wait for 2 hours to 30 days (usually about a week or 2 for me for iOS depending on holidays etc. for a first submission, updates are usually a bit faster, no idea yet what the Mac App Store waits will be but I'm guessing similar) for apple to approve or deny your submission. If they deny they give you (usually somewhat vague, but if you read closely you should figure out what they mean) reason(s) for your refusal. If denied, correct what they said was out of line and re-submit, no penalty besides wasted time for getting turned down (if you get turned down a lot however they might lower your submission priority meaning it takes longer to get them to look at it, so try to get it right as fast as possible rather than bouncing ideas off them.)

Of note, if you plan on selling things you will also need to agree to the legal docs regarding the payment contracts etc. through iTunes connect as well and wait for that to get approved (day to weeks again depending on who/what you are etc.) and you will need to attach the payment to a major bank account and get that validated (usually a day). If you're just doing free stuff (bear in mind, unlike iOS demos and trials are NOT welcome in the mac store... full versions only... I have a suspicion that they will be adding a demoing system in sometime in the future) then you don't need to bother with this, it's all in the main agreement when you sign up.

If anyone cares, this is almost exactly the same process for iOS developer accounts. The apps are obviously different, and the bundling is different (it must be signed in xcode, and you just zip the app with it's distribution profile rather than creating a package...), but all the legal stuff, timing, dev portals, itunes connect, etc. are all integrated together. If you have an account for both everything shows up under iTunes Connect, your mac and iOS apps, tracking, payments, etc.

Hope that helps! Just remember it's apple's playground and you have to play by their rules if you want to join in :0) thankfully, unlike iOS, if you don't like the rules you can always just go the traditional way.


ima747(Posted 2011) [#6]
One last thing, when you sign up for a developer account you get I believe 2 free support incidents, in addition to free general support. Basically if you have a general question like "how do I get my certs?" you can ask and it's apple support which is just as good for devs as for consumers (read quick and people actually know what they're doing, not reading off a prompter, a.k.a. what support should be). So if you get stuck they can help. Support incidents are basically 1 on 1 support with an apple developer. Meaning you can say "Here's my code why does this leak like crazy?" (as long as you're using xcode and writing in an officially supported language of course...) and they will give it a look over and help you fix it up. I've never had to use any incidents in the couple years I've had them because the official forum (which is peppered with official apple devs) and google can usually get things rolling, but it's very nice to know there's backup should something go horribly horribly wrong, you won't be out $99 for nothing.


Cartman(Posted 2011) [#7]
Mine just got rejected for writing in the wrong location. I thought that might happen, but I wasn't quit clear on what a safe location was. Hopefully it will go better after I resubmit on Monday.


ima747(Posted 2011) [#8]
Good luck. I suspect that will be another factor for mine aswell. But that's actually good. Got rejected for documented compliance issue, not something arbitrary or for something bmax specific!


Cartman(Posted 2011) [#9]
OK. So I fixed the save location issue, but now I've got a build problem. Hopefully someone here has an idea. My certs seem to go find and I build the package all via Terminal. When I run the

sudo installer -store -pkg MajesticForest.pkg -target /

command, it seems to be installing:

Password:
installer: Installation Check: Passed
installer: Volume Check: Passed
installer: Starting install
installer: Install 0.0% complete
installer: Install 6.5% complete
installer: Install 12.2% complete
installer: Install 17.2% complete
installer: Install 21.7% complete
installer: Install 25.8% complete
installer: Install 32.7% complete
installer: Install 35.7% complete
installer: Install 41.0% complete
installer: Install 53.6% complete
installer: Install 55.7% complete
installer: Install 100.0% complete
installer: Finished install


But when I go to the Applications folder on my Macintosh HD, I don't see my game. I've searched the hard drives to see if it got installed somewhere else. Rebooted. And emptied my trash. The documentation from Apple says that it could be updating a previous instance of the program, but I can't find the previous instance, if that's the issue.

Does anyone have any idea why I wouldn't see my application in the Applications folder and yet the install package seems to install fine?

Thanks for any help.


jkrankie(Posted 2011) [#10]
It's because you have the game installed elsewhere. move any other copies of you app to the trash and you should see the installer install the file in applications. If it finds your app elsewhere, it'll just update that one.

Cheers
Charlie


Cartman(Posted 2011) [#11]
Thanks Charlie. That's what I thought was going on. I'll completly clean any copies I have off the machine and try again.


ima747(Posted 2011) [#12]
Jkrankle has reported being accepted!
http://www.blitzbasic.com/Community/posts.php?topic=93712#1073228
congrats to him, and I recommend a read through that thread as it can help resolve some bmax specific reasons for rejection (such as full screen command q support...), as well as some more general ones (such as storage locations... Make sure you read up on apples requirements, they're the same for everyone regardless of development tools...)


ima747(Posted 2011) [#13]
Yay! now I too can report being accepted. 16 days of waiting for review, 6.5 hours of in review and about 30 minutes of processing for app store. For the record that's about double what it usually takes me to get something onto the iOS app store. I know I have a couple very minor policy violations (my settings are saved in the correct location, but the file is not named to match the bundle identifier, however it is easily identifiable as as settings file for my program.) I'm guessing they just said "close enough" since it was just a tiny thing or 2. My future submissions will adhere more closely to the guidelines (I just threw this one at the store to get my feet wet) to limit any chance for refusal.

So in summation, the guide posted above, a lot of patience and a little luck should get the job done. Best wishes to all who apply.

One last note. As with the iOS app store, once you're accepted it takes time before your app is locatable through search and by browsing. Usually take about 24-36 hours for iOS, if it's like the review process I expect it to take a little longer for mac.

I have a feeling the extra time everything takes is due to:
1) MANY more guidelines they have to check the apps agains vs iOS
2) YEARS of people making apps and having nowhere to sell them easily, I imagine there's TONS of people re-compiling everything under the sun and hitting submit without complying with the guidelines. Make your reviewer happy, spend some time reading up on the finer points so it's easy for them to OK you the first time (or get lucky and hope they're not watching too close like me ;0).


jkrankie(Posted 2011) [#14]
So what is your game called? post a link!

Cheers
Charlie


JoshK(Posted 2011) [#15]
When I attempted Step 3 there was no response. No error was printed, no messages, nothing. I have Xcode 3.2.6 installed. I don't know if "Developer Tools" means something beyond that, but the Developer Area said I should install Xcode 3.2.5 or higher for the App Store.


JoshK(Posted 2011) [#16]
Recompiled and trying it again. Now I just get "code object not found" when I try to sign the thing.

Last login: Thu Mar 31 14:16:41 on ttys000
Josh-Klints-iMac:~ jklint$ /Volumes/USB\ STICK/Image\ Viewer
-bash: /Volumes/USB STICK/Image Viewer: is a directory
Josh-Klints-iMac:~ jklint$ codesign -f -s "3rd Party Mac Developer Application: Josh Klint" "ImageViewer.app"
ImageViewer.app: cannot find code object on disk
Josh-Klints-iMac:~ jklint$


Last edited 2011


JoshK(Posted 2011) [#17]
Where is the LSApplicationCategoryType key found? There's nothing like that in the list of things items I can add.


jkrankie(Posted 2011) [#18]
You need to add it yourself.

Cheers
Charlie


SLotman(Posted 2011) [#19]
Where can I get that 'productbuild' metioned to package the program?

I've already signed my app (I think) but I don't have the productbuild program in my system, and I can't find it anywhere... does it come with xcode? That's the only thing I can see to download on Apple's site, besides an IDE, a LLVM compiler, a performance analyzer and an iOS simulator.

I am downloading xcode (I've already installed it before, but who knows) but it's taking forever to download the 4gb file - would be nice to know if the builder is in it or if I'm wasting my time :/

Edit: found it on XCode, and managed to create the .pkg... now Application Loader is giving me trouble, telling me "no eligible applications found", even though I did create app ids on iTunes connect :(

Edit 2:finally, I'm uploading my pkg... will let you know if it's approved :)

Last edited 2011


ima747(Posted 2011) [#20]
Glad you got it sorted.

To clarify, productbuild and codesign command line applications were, at the writing of this article, a separate package available through the Apple developer page if you were a paid mac developer. They have since been merged into XCode to the best of my knowledge as there is no longer a separate package to download and install. So if you've got new XCode installed (3.x or 4.x) you should have the command line tools required as well... in theory... since I installed the package I'm not 100% on that, but it's what I've gathered.


SLotman(Posted 2011) [#21]
Hey, no complaints here... your guide helped me *a lot* - I would still be looking for info on Apple's website otherwise :)

Once again, thank you so much for taking the time to write this!


SLotman(Posted 2011) [#22]
Got accepted!

That was fast! 4 days, and the only problem I had was my game is called "Puzzle Trip:Rio", but the .app name was just "rio.app" - I had to rebuild/rename it - and that was it :)

I still have other game in the queue, one using miniB3D, so let's see how that one go :)

Edit: "Fruzzle" has just been accepted as well!

Once more, ima747 - thank you very much for your tutorial!

Last edited 2011


matt!(Posted 2011) [#23]
Thanks for this guide.

Just submitted my first BMX Mac App :)


Blitzplotter(Posted 2012) [#24]
very comprehensive guide, thankyou.


Oddball(Posted 2012) [#25]
Breezed through the AppStore review process without a hitch thanks to this kind. This guide should be sticky-ed. Cheers.

http://itunes.apple.com/app/hack-slash-loot/id507211634?mt=12


TikiDays(Posted 2013) [#26]
Hi, can this be updated with Sandbox compliance?


TikiDays(Posted 2013) [#27]
Thumbpics accepted :)

https://itunes.apple.com/nz/app/thumbpics/id657247676?mt=12