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 here after 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 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 shown below
<?xml version=”1.0" encoding=”UTF-8"?> <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “[http://www.apple.com/DTDs/PropertyList-1.0.dtd](http://www.apple.com/DTDs/PropertyList-1.0.dtd)"> <plist version=”1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>ufo</string> <key>CFBundleGetInfoString</key> <string>Victor Leung 2016. All rights reserved.</string> <key>CFBundleIconFile</key> <string>PlayerIcon.icns</string> <key>CFBundleIdentifier</key> <string>unity.victorleungtw.ufo</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>ufo</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.4.0</string> <key>CFBundleSignature</key> <string>unity.victorleungtw.ufo</string> <key>CFBundleVersion</key> <string>1.4.0</string> <key>LSApplicationCategoryType</key> <string>public.app-category.games</string> </dict> </plist>
In your Build folder, create a file GAMENAME.entitlements, with sand-box key like this:
<?xml version=”1.0" encoding=”UTF-8"?> <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version=”1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> </dict> </plist>
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 new certificate. You will need to go through the process twice to get type of “Mac App Distribution” and “Mac Installer Distribution”. Save them to key chain, which will be use 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
Login 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 couple to steps to go through first:
Fix the permission of the content via 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 takes 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 subcomponent didn’t sign correctly, which you may need to spend sometime on Apple documentations 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 :)