Skip to content

Commit ffd22a8

Browse files
Cong Liurogerwang
authored andcommitted
Added docs for "Support for Mac App Store"
1 parent 767f0e0 commit ffd22a8

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Support for Mac App Store {: .doctitle}
2+
---
3+
4+
[TOC]
5+
6+
## Overview
7+
8+
You can distribute your macOS apps through official Mac App Store or outside the store. But the apps should always be signed before distribution. Unsigned apps are refused to be launched by the [Gatekeeper](https://support.apple.com/en-us/HT202491).
9+
10+
This guide will show you how to sign NW.js based apps for macOS.
11+
12+
## Prerequisits
13+
14+
* Create a macOS app through [iTunesConnect](https://itunesconnect.apple.com)
15+
* Obtain Application & Installer certificates from [Apple Developer](https://developer.apple.com).
16+
- If you distribute your app through **Mac App Store**:
17+
+ 3rd Party Mac Developer Application: Foo (XXXXXXXXXX)
18+
+ 3rd Party Mac Developer Installer: Foo (XXXXXXXXXX)
19+
- If you distribute your app **outside the store**:
20+
+ Developer ID Application: Foo (XXXXXXXXXX)
21+
+ Developer ID Installer: Foo (XXXXXXXXXX)
22+
23+
## Build the App
24+
25+
Download NW.js MAS build from [nwjs.io](http://dl.nwjs.io/v0.19.5-mas-beta/) and build your app as described in [Package and Distribute](../Package and Distribute.md).
26+
27+
## Sign the App
28+
29+
`build_mas.py` is used to sign your app for macOS. And the script can generate an uploadable `.pkg` file for Mac App Store after signing by giving `--pkg` argument.
30+
31+
**Basic Usage**
32+
33+
```bash
34+
python build_mas.py -C build.cfg -I myapp-dev.app -O MyApp.app
35+
```
36+
37+
## Configuration File Format
38+
39+
Configuration file (`build.cfg`) is a human readable text file. It contains important settings for signing and packaging the app.
40+
41+
`ApplicationIdentity` and `InstallerIdentity` are the names of the certificates used for signing and packaging your app. See [Prerequisits](#prerequisits) for which certificates you need.
42+
43+
`NWTeamID` is used to establish IPC channels for launch NW.js based app. It can be obtained from Apple Developer -> Membership -> Team ID.
44+
45+
`ParentEntitlements` and `ChildEntitlements` should be valid [entitlements files](https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AboutEntitlements.html). By default, your app is signed with minimal privileges as below.
46+
47+
**entitlements-parent.plist**
48+
49+
```xml
50+
<?xml version="1.0" encoding="UTF-8"?>
51+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
52+
<plist version="1.0">
53+
<dict>
54+
<key>com.apple.security.app-sandbox</key>
55+
<true/>
56+
<key>com.apple.security.application-groups</key>
57+
<string>NWTeamID.your.app.bundle.id</string>
58+
</dict>
59+
</plist>
60+
```
61+
62+
**entitlements-child.plist**
63+
64+
```xml
65+
<?xml version="1.0" encoding="UTF-8"?>
66+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
67+
<plist version="1.0">
68+
<dict>
69+
<key>com.apple.security.app-sandbox</key>
70+
<true/>
71+
<key>com.apple.security.inherit</key>
72+
<true/>
73+
</dict>
74+
</plist>
75+
```
76+
77+
Read the sample `build.cfg` for detailed meanings all fields.

docs/For Users/Package and Distribute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ On Mac OS X, you need to modify following files to have your own icon and bundle
9393
* `Contents/Resources/nw.icns`: icon of your app. `nw.icns` is in [Apple Icon Image Format](https://en.wikipedia.org/wiki/Apple_Icon_Image_format). You can convert your icon in PNG/JPEG format into ICNS by using tools like [Image2Icon](http://www.img2icnsapp.com/).
9494
* `Contents/Info.plist`: the apple package description file. You can view [Implementing Cocoa's Standard About Panel](http://cocoadevcentral.com/articles/000071.php) on how this file will influence your app and what fields you should modify.
9595

96-
And you should sign you Mac app. Or the user won't launch the app if Gatekeeper is turned on. See [Signed Apps or Installer Packages](https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/DistributingApplicationsOutside/DistributingApplicationsOutside.html) for details.
96+
You should sign your Mac app, or the user won't launch the app if Gatekeeper is turned on. See [Support for Mac App Store](Advanced/Support for Mac App Store.md) for details.
9797

9898
## References
9999

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The source of the document is in [our git repo](https://github.com/nwjs/nw.js/tr
2525
+ [JavaScript Contexts in NW.js](For Users/Advanced/JavaScript Contexts in NW.js.md)
2626
+ [Protect JavaScript Source Code](For Users/Advanced/Protect JavaScript Source Code.md)
2727
+ [Security in NW.js](For Users/Advanced/Security in NW.js.md)
28+
+ [Support for Mac App Store](For Users/Advanced/Support for Mac App Store.md)
2829
+ [Test with ChromeDriver](For Users/Advanced/Test with ChromeDriver.md)
2930
+ [Use Flash Plugin](For Users/Advanced/Use Flash Plugin.md)
3031
+ [Use NaCl in NW.js](For Users/Advanced/Use NaCl in NW.js.md)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pages:
3737
- 'JavaScript Contexts in NW.js': 'For Users/Advanced/JavaScript Contexts in NW.js.md'
3838
- 'Protect JavaScript Source Code': 'For Users/Advanced/Protect JavaScript Source Code.md'
3939
- 'Security in NW.js': 'For Users/Advanced/Security in NW.js.md'
40+
- 'Support for Mac App Store': 'For Users/Advanced/Support for Mac App Store.md'
4041
- 'Test with ChromeDriver': 'For Users/Advanced/Test with ChromeDriver.md'
4142
- 'Transparent Window': 'For Users/Advanced/Transparent Window.md'
4243
- 'Use Flash Plugin': 'For Users/Advanced/Use Flash Plugin.md'

0 commit comments

Comments
 (0)