Electron-osx-sign: App does not launch after sign or I got a blank electron window (macOS 10.14.4)

Created on 20 Jan 2020  路  5Comments  路  Source: electron/electron-osx-sign

I need to sign my Electron application to submit to App Store. I tried with electron-osx-sign and the Mac App Store Submission Guide here, but with both I cannot open the application after signing.

I build my app with electron-packager using this command:

electron-packager . --app-bundle-id=my-bundle-id --helper-bundle-id=my-bundle-id.helper --app-version=1.1.22 --build-version=1.1.23 --platform=mas --arch=x64 --electron-version=3.0.4 --icon=assets/icons/mac/icon.icns --type=distribution --out=app-store --overwrite

After running this command I am able to open the .app file without problems. Then I try to sign the .app file and generate the .pkg file using these commands:

export DEBUG=electron-osx-sign*
electron-osx-sign 'app-store/Tok-mas-x64/Tok.app' --entitlements='build/entitlements.mas.plist' --entitlements-inherit='build/child.plist' --identity='3rd Party Mac Developer Application: My Company (XXXXX)' --provisioning-profile='embedded.provisionprofile' --verbose

I got the following message in terminal: "_Application signed: app-store/Tok-mas-x64/Tok.app_"

If I open the app file I got a blank electron window. If I run the following command

electron-osx-flat 'app-store/Tok-mas-x64/Tok.app' --entitlements='build/entitlements.mas.plist' --identity='3rd Party Mac Developer Installer: My Company (XXXXX)' --provisioning-profile='embedded.provisionprofile' --verbose

I got the .pkg file, that I am able to install successfully but then I cannot find the app between my applications. If I try to open the .app file, the app crashes with this error: "Termination Reason: Namespace CODESIGNING, Code 0x1"

I also tried signing manually, running this script

image

In the terminal I got this:
/Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app/Contents/Frameworks/Electron Framework.framework: replacing existing signature /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app/Contents/Frameworks/Tok Helper.app/: replacing existing signature /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app/Contents/Library/LoginItems/Tok Login Helper.app/: replacing existing signature /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app/Contents/MacOS/Tok: **code object is not signed at all** In subcomponent: /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app/Contents/Frameworks/Tok Helper NP.app /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app: ### code object is not signed at all In subcomponent: /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app/Contents/Frameworks/Tok Helper NP.app productbuild: Adding component at /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.app productbuild: Signing product with identity "3rd Party Mac Developer Installer: My company (XXXX)" from keychain /Users/irisgaleano/Library/Keychains/login.keychain-db productbuild: Adding certificate "Apple Worldwide Developer Relations Certification Authority" productbuild: Adding certificate "Apple Root CA" productbuild: Wrote product to /Users/irisgaleano/Electron-projects/tok-electron/app-store/Tok-mas-x64/Tok.pkg productbuild: Supported OS versions: [10.9.0, )

The problems are similar. I got the .pkg file, that I am able to install successfully but then I cannot find the installed app. If I try to open the .app file, I got a blank electron window again.

These are my entitlements.

entitlements.mas.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.developer.aps-environment</key> <string>development</string> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.application-groups</key> <string>my.bundle.id</string> <key>com.apple.security.files.downloads.read-write</key> <true/> <key>com.apple.security.files.user-selected.read-write</key> <true/> <key>com.apple.security.network.client</key> <true/> <key>com.apple.developer.team-identifier</key> <string>XXXX</string> <key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/> </dict> </plist>

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>

loginhelper.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>

These are the cert.

image

electron: 3.0.4 electron-builder: 12.2.0 electron-osx-sign: 0.4.15

I tried this recommendation [#200] and this [#188] with not success.

Anyone can help me please? Thanks.

question

All 5 comments

Remove existing "Tok.app"s in your Mac.
And, retry installing with .pkg .
Is there "Tok.app" in your "Application" Folder ?

I got the .pkg file, that I am able to install successfully but then I cannot find the app between my applications.

Got exactly same problem

Same problem here

I'm also experiencing this. If I run the binary within the app's MacOS directory I see that it fails to load the html file for the window. This was called via win.loadFile. The path it references is valid and can be accessed with other applications however when it tries to load it responds with ERR_FAILED -2.

Could it be a new type of permission is required to access file:// URLs?

Was able to resolve this following another thread which I don't have bookmarked -- basically, you need to make sure you're signing like this:

--entitlements=entitlements.plist --entitlements-inherit=entitlements.plist --hardenedRuntime

<?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.cs.allow-jit</key> <true/> <key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/> <key>com.apple.security.cs.disable-library-validation</key> <true/> <key>com.apple.security.cs.disable-executable-page-protection</key> <true/> </dict> </plist>

It's obviously not too well documented, but if you're hitting this error, you're probably missing --entitlements-inherit

Was this page helpful?
0 / 5 - 0 ratings