electron/docs/tutorial/mac-app-store-submission-guide.md
2015-10-16 17:16:12 +08:00

4.9 KiB

Mac App Store Submission Guide

Since v0.34.0, Electron allows submitting packaged apps to Mac App Store (MAS), this guide provides information on how to submit your app, and the limitations of the MAS build.

How to submit your app

Following steps introduces a simple way submit your app to Mac App Store, but it doesn't make sure your app gets approved by Apple, you still have to read apple's Submitting Your App guide on how to meet Mac App Store's requirements.

Get certificate

To submit your app to Mac App Store, you have to get a certificate from Apple first, you can follow existing guides on web:

Sign your app

After getting the certificate, you can package your app by following Application Distribution, and then sign your app. The step is basically the same with other programs, the key is to sign every dependency of Electron one by one.

First you need to prepare two entitlements files.

child.plist:

<?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/>
    <key>com.apple.security.inherit</key>
    <true/>
  </dict>
</plist>

parent.plist:

<?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>

And then sign your app with following script:

#!/bin/bash

# Name of your app.
APP="YourApp"
# The path of you app to sign.
APP_PATH="/path/to/YouApp.app"
# The path to the location you want to put the signed package.
RESULT_PATH="~/Desktop/$APP.pkg"
# The name of certificates you requested.
APP_KEY="3rd Party Mac Developer Application: Company Name (APPIDENTITY)"
INSTALLER_KEY="3rd Party Mac Developer Installer: Company Name (APPIDENTITY)"

FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"

codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Framework.framework/Libraries/libnode.dylib"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Framework.framework/$APP Framework"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Framework.framework/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Helper.app/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Helper EH.app/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Helper NP.app/"
codesign  -fs "$APP_KEY" --entitlements parent.plist "$APP_PATH"
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$APP_PATH"

If you are new to app sandboxing of OS X, you should also go through Apple's Enabling App Sandbox to have a basic idea, and add keys for the permissions needed by your app to the entitlements files.

Upload your app and submit for review

After signing your app you can use Application Loader to upload it to iTunes Connect for processing, make sure you have created a record before uploading. Then you can submit your app for review.

Limitations of MAS build

In order to satisfy requirements for app sandboxing, following modules have been disabled in MAS build:

  • crash-reporter
  • auto-updater

and following behaviors have been changed:

  • Video capture may not work for some machines.
  • Certain accessibility features may not work.
  • Apps will not be aware of DNS changes.

Also due to the usage of app sandboxing, the resources can be accessed by the app is strictly limited, you can read App Sandboxing for more.