After 3 months of development on the weekends, our unity 3D game is ready to release and deploy to App Store. However, it was not straight forward at all, and I spent a whole night to figure it out. So I decided to document some of the key steps hereafter many trial and error:
1. Unity Build Settings
In Unity, choose “File” > “Build Settings” > Platform “PC, Mac & Linux Standalone” > Choose target platform “Mac OS”.
Click “Player Settings…” select your default icon and config with:
Default is Full Screen = true
Default is Native Resolution = true
Capture Single Screen = false
Display Resolution Dialog = false
Mac App Store Validation = true
In Finder, right-click on the game app to ‘Show Package Content’. Inside the Content folder, edit the Info.plist file. Make sure
- CFBundleGetInfoString is a valid string
- CFBundleIdentifier and CFBundleSignature has values match with bundle id (will explain later)
- CFBundleShortVersionString and CFBundleVersion are in the version number x.x.x, e.g. 1.0.0
- Add a new
LSApplicationCategoryTypewith values public.app-category.games
Example is shown below
In your Build folder, create a file GAMENAME.entitlements, with a sand-box key like this:
4. Apple Developer Account
Assume you have already paid and got an Apple developer account. Visit https://developer.apple.com/account/ , then go to certificates, choose the dropdown with “OS X” and click the “+” button for creating a new certificate. You will need to go through the process twice to get a type of “Mac App Distribution” and “Mac Installer Distribution”. Save them to a key chain, which will be used later.
Next, go to “Identifiers” and choose “App IDs” tab, you can create a Wildcard App ID, but make sure it matches with the previous step bundle id values. For example, mine is unity.victorleungtw.*
5. iTunes Connect
Log in to iTunes Connect, choose My Apps > “+” > “New Mac App”, fill in the values and choose the bundle ID matches with the previous step. The prefix field would be the game name, such us ufo in my case.
After filling in the form, you will also need to spend some time to take screenshots, and crop them in the right size. Only the following sizes are allowed:
- 1280 x 800 pixels
- 1440 x 900 pixels
- 2560 x 1600 pixels
- 2880 x 1800 pixels
6. Application Loader
Download and install the latest Application Loader to submit the app. There are a couple to steps to go through first:
Fix the permission of the content via a command in terminal:
chmod -R a+xr “/path/to/GAMENAME.app”
Sign the app with the created document in step 3.
codesign -f -s ‘3rd Party Mac Developer Application: DEVELOPER NAME’ —entitlements “GAMENAME.entitlements” “/AppPath/GAMENAME.app”
However, you’re likely to get the error:
code object is not signed at all
This is because the subcomponent is not signed. You could sign the subcomponents one by one, including libmono.0.dylib and libMonoPosixHelper.dylib etc, but easier way just use the deep sign command, like this:
codesign -f -s ‘3rd Party Mac Developer Application: DEVELOPER NAME’ —entitlements “GAME.entitlements” “GAMENAME.app” —deep
Next build the .pkg file:
productbuild —component GAMENAME.app /Applications —sign “3rd Party Mac Developer Installer: DEVELOPER NAME” GAMENAME.pkg
Remove any existing game.app in your machine then you can verify the install by:
sudo installer -store -pkg GAMENAME.pkg -target /
Finally, open the Application Loader and ‘Deliver Your App’ by choosing the GAMENAME.pkg. If things go well, then you should be able to upload it. Otherwise, fix the specific errors accordingly. It will take a while to go through.
7. Select the build
If you got an email with issues,
Invalid Signature — The main app bundle game at path GAMENAME.app has following signing error(s): invalid Info.plist (plist or signature have been modified) In architecture: i386 .
It is probably one of your subcomponents didn’t sign correctly, which you may need to spend some time on Apple documentation to understand how it works.
Otherwise, head back to iTunes Connect, select the uploaded build, and change the status “Preparing for review” > “Waiting For Review” > “Review” > “Ready for Sale”!
Hope this blog is helpful and could save you some time :)