electron/docs/tutorial/mac-app-store-submission-guide.md

121 lines
4.9 KiB
Markdown
Raw Normal View History

2015-10-16 09:15:23 +00:00
# Mac App Store Submission Guide
2015-10-21 20:03:12 +00:00
Since v0.34.0, Electron allows submitting packaged apps to the Mac App Store
(MAS). This guide provides information on: how to submit your app and the
limitations of the MAS build.
2015-10-16 09:15:23 +00:00
__Note:__ Submitting an app to Mac App Store requires enrolling [Apple Developer
Program][developer-program], which costs money.
## How to Submit Your App
2015-10-16 09:15:23 +00:00
2015-10-21 20:03:12 +00:00
The following steps introduce a simple way to submit your app to Mac App Store.
However, these steps do not ensure your app will be approved by Apple; you
2015-10-21 20:03:12 +00:00
still need to read Apple's [Submitting Your App][submitting-your-app] guide on
how to meet the Mac App Store requirements.
2015-10-16 09:15:23 +00:00
### Get Certificate
2015-10-16 09:15:23 +00:00
2015-10-21 20:03:12 +00:00
To submit your app to the Mac App Store, you first must get a certificate from
Apple. You can follow these [existing guides][nwjs-guide] on web.
2015-10-16 09:15:23 +00:00
### Sign Your App
2015-10-16 09:15:23 +00:00
After getting the certificate from Apple, you can package your app by following
2015-10-21 20:03:12 +00:00
[Application Distribution](application-distribution.md), and then proceed to
signing your app. This step is basically the same with other programs, but the
key is to sign every dependency of Electron one by one.
2015-10-16 09:15:23 +00:00
First, you need to prepare two entitlements files.
2015-10-16 09:15:23 +00:00
`child.plist`:
```xml
<?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
<?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 the following script:
2015-10-16 09:15:23 +00:00
```bash
#!/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"
2015-10-16 12:21:06 +00:00
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/Electron Framework.framework/Libraries/libnode.dylib"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/Electron Framework.framework/Electron Framework"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/Electron Framework.framework/"
2015-10-16 09:15:23 +00:00
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"
2015-11-09 03:42:37 +00:00
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"
2015-10-16 09:15:23 +00:00
```
2015-10-21 20:03:12 +00:00
2015-11-09 03:42:37 +00:00
If you are new to app sandboxing under OS X, you should also read through
2015-10-21 20:03:12 +00:00
Apple's [Enabling App Sandbox][enable-app-sandbox] to have a basic idea, then
add keys for the permissions needed by your app to the entitlements files.
2015-10-16 09:15:23 +00:00
### Upload Your App and Submit for Review
2015-10-16 09:15:23 +00:00
After signing your app, you can use Application Loader to upload it to iTunes
Connect for processing, making sure you have [created a record][create-record]
2015-10-16 09:15:23 +00:00
before uploading. Then you can [submit your app for review][submit-for-review].
## Limitations of MAS Build
2015-10-16 09:15:23 +00:00
2015-10-21 20:03:12 +00:00
In order to satisfy all requirements for app sandboxing, the following modules
have been disabled in the MAS build:
2015-10-16 09:15:23 +00:00
* `crash-reporter`
* `auto-updater`
and the following behaviors have been changed:
2015-10-16 09:15:23 +00:00
* 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 which can be accessed by
the app are strictly limited; you can read [App Sandboxing][app-sandboxing] for
more information.
2015-10-16 09:15:23 +00:00
[developer-program]: https://developer.apple.com/support/compare-memberships/
2015-10-16 09:15:23 +00:00
[submitting-your-app]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html
[nwjs-guide]: https://github.com/nwjs/nw.js/wiki/Mac-App-Store-%28MAS%29-Submission-Guideline#first-steps
[enable-app-sandbox]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html
[create-record]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html
[submit-for-review]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
[app-sandboxing]: https://developer.apple.com/app-sandboxing/