Did Unity 4 change how one can package an app for the Mac App Store?

Hi there.

We recently upgraded to Unity 4, and I am making a Mac App Store package for my project. I used the process I describe below to create the package (using sandboxing) and then test the installer. This worked great before Unity 4, but now, after I install it, the app closes immediately after startup. This makes me think that the packaging/sandboxing process isn’t working the same way as it did before. Alternatively, it could be something wrong with the way I’m installing the package. I would like to test my app before I submit it to the app store, so any information would be helpful.

Here was my process:

  1. In Unity, make sure the “Mac App Store Validation” flag is checked on my Player Settings
  2. Build app
  3. Put in the correct Info.plist file, as well as icon files and MainMenu.nib file.
  4. Make an Entitlements file, allowing for sandboxing.
  5. Open up a terminal and navigate to the folder that has the Unity build in it.
  6. Type the following line:
    chmod -R a+xr AppName.app
    (This gives you permission to codesign files)
  7. Type the following line:
    codesign -f -s “3rd Party Mac Developer Application: Company” --entitlements AppName.entitlements AppName.app
    (This codesigns the whole app with the permissions granted by the entitlements file and our own developer certificate)
  8. Type the following line:
    codesign -f -s “3rd Party Mac Developer Application: Company” AppName.app/Contents/Frameworks/MonoEmbedRuntime/osx/libmono.0.dylib
    (For whatever reason, this file doesn’t get modified properly. It has no need for the entitlements, but it does need to be targeted and codesigned directly)
  9. Type the following line:
    productbuild --component AppName.app /Applications --sign “3rd Party Mac Developer Installer: Company” AppName.pkg
    (This creates the actual .pkg file that you will be uploading to the Mac AppStore. It creates it in the same folder as the build folder. To change the location, change the very last part of the command so that AppName.pkg is saved to somewhere else.)
  10. App Store package now exists.

Testing the app:

  1. Type sudo installer -store -pkg AppName.pkg -target /
  2. Type in computer’s password, if queried.
  3. Start up app from the Applications folder
  4. Type in username/password if queried.
  5. Expected (and previous Unity version results): App runs. Actual result: App immediately closes.

Thanks all!

I have been tearing my hair out over this, too… But look what I found!