最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to publish Electron app to the app store? - Stack Overflow

programmeradmin3浏览0评论

I've packaged the app to mas file for uploading to the App Store. But

  1. From Xcode 11, they don't provide an application loader anymore.
  2. The Electron doesn't generate the XCode project.

In this case, what will be the best solution?

I've packaged the app to mas file for uploading to the App Store. But

  1. From Xcode 11, they don't provide an application loader anymore.
  2. The Electron doesn't generate the XCode project.

In this case, what will be the best solution?

Share Improve this question edited Nov 24, 2021 at 4:24 tpikachu asked Aug 2, 2020 at 13:29 tpikachutpikachu 4,8542 gold badges21 silver badges45 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

1. We need to generate certificates on developer.apple. and also need to import into our keychain.

  • Apple Development Certificates
  • Apple Distribution Certificates
  • Mac App Distribution Certificates (For Notarization)
  • Mac Installer Distribution Certificates (For Notarization)
  • (3rd Party) Developer ID Application Certificates (For publishing to App store)
  • (3rd Party) Developer ID Installer Certificates (For publishing to App store)

And then you need to download your app's provision profile from the app store connect. (Place this wherever you wanna be but need to indicate this in configuration)

You can find create and download the app's provision profile here https://developer.apple./account/resources/profiles/list

2. Need to configure your electron-builder. Here is the configuration.

{
    "productName": "your product",
    "appId": ".my.first.app", //which can be found on your app store connect
    "directories": {
        "buildResources": "buildResources",
        "output": "release"
    },
    "files": ["main.js", "node_modules", "build" ], // include other necessary resources.
    "mac": {
        "type": "distribution",
        "target": ["mas", "pkg", "dmg"],
        "artifactName": "${productName}-${version}-${os}.${ext}",
        "category": "public.app-category.utilities",
        "provisioningProfile": "embedded.provisionprofile"
    },
    "mas": {
        "hardenedRuntime" : false, //IMPORTANT!!!!
        "type": "distribution",
        "category": "public.app-category.utilities",
        "entitlements": "build/entitlements.mas.plist",
        "entitlementsInherit": "build/entitlements.mas.inherit.plist"
    },
}

build/entitlements.mas.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple./DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>.apple.security.app-sandbox</key>
        <true/>
        <key>.apple.security.application-groups</key>
        <string>[prefix (on your app store connect)].[app bundleID EX: .desktop.app]</string>
        <key>.apple.security.cs.allow-jit</key>
        <true/>
        <key>.apple.security.cs.allow-unsigned-executable-memory</key>
        <true/>
        <key>.apple.security.cs.allow-dyld-environment-variables</key>
        <true/>
    </dict>
</plist>

build/entitlements.mas.inherit.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple./DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>.apple.security.app-sandbox</key>
        <true/>
        <key>.apple.security.inherit</key>
        <true/>
    </dict>
</plist>

(as this entitlements list are the basic one and you can configure as your needs, but the above one is mandatory for publishing the app store. Especially, sand-box must be set as Apple's requirement)

After run npm run build which means (electron-builder .) Electron-builder will generate the mas, mac, pkg and then

3. To upload the app to the Mac App Store. I've used Transporter which is available on the Mac App Store. (As I mentioned before on question. From Xcode11 they don't support application loader anymore)

IMPORTANT: Electron-builder has fixed the signing issue from v22.5.0 So you need to use later version.

Finally here is the project structure that is working well with the current electron-builder.

REFERENCE:

https://medium./@jondot/shipping-electron-apps-to-mac-app-store-with-electron-builder-e960d46148ec

https://github./electron/electron-osx-sign/issues/188

https://github./electron/electron/issues/22656

Hope this helps you so much~

(When the sandbox is enabled app is stopped working. This is normal behavior)

发布评论

评论列表(0)

  1. 暂无评论