ElectronアプリをMac App Storeにアップロードしようとしていますが、App Sandboxが有効になっていないというエラーが発生し、解決できていません。
Validation failed (409)
App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list: [
"coiai.net.sonivium.pkg/Payload/Sonivium.app/Contents/Frameworks/Sonivium Helper (GPU).app/Contents/MacOS/Sonivium Helper (GPU)",
"coiai.net.sonivium.pkg/Payload/Sonivium.app/Contents/Frameworks/Sonivium Helper (Plugin).app/Contents/MacOS/Sonivium Helper (Plugin)",
"coiai.net.sonivium.pkg/Payload/Sonivium.app/Contents/Frameworks/Sonivium Helper (Renderer).app/Contents/MacOS/Sonivium Helper (Renderer)",
"coiai.net.sonivium.pkg/Payload/Sonivium.app/Contents/Frameworks/Sonivium Helper.app/Contents/MacOS/Sonivium Helper",
"coiai.net.sonivium.pkg/Payload/Sonivium.app/Contents/Library/LoginItems/Sonivium Login Helper.app/Contents/MacOS/Sonivium Login Helper",
"coiai.net.sonivium.pkg/Payload/Sonivium.app/Contents/MacOS/Sonivium"
– **OS**: macOS (darwin 25.0.0)
– **Electron**: 39.2.7
– **electron-builder**: 25.1.8
– **アプリID**: `coiai.net.sonivium`
– **Team ID**: `45J6U33V86`
"mas": {
"category": "public.app-category.utilities",
"icon": "logo/Output/macOS/AppIcon.appiconset/Icon-mac-512.png",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mas.plist",
"entitlementsInherit": "build/entitlements.mas.plist",
"target": [
{
"target": "mas",
"arch": ["arm64", "x64"]
}
],
"bundleVersion": "1",
"extendInfo": {
"LSHasLocalizedDisplayName": true,
"CFBundleDevelopmentRegion": "ja",
"CFBundleURLName": "coiai.net.sonivium",
"ElectronTeamID": "45J6U33V86"
},
"electronLanguages": ["ja", "en"],
"identity": "Apple Distribution: Akira Hattori (45J6U33V86)",
"preAutoEntitlements": false
}
“`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>
<!– App Store用のentitlements – App Sandboxは必須 –>
<key>com.apple.security.app-sandbox</key>
<true/>
<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.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
</dict>
</plist>
“`
最初は別のファイル(`entitlements.mas.child.plist`)を指定していましたが、エラーが続いたため、メインのentitlementsファイルと同じファイルを指定するように変更しました。
“`json
“entitlementsInherit”: “build/entitlements.mas.plist”
“`
– ✅ **Apple Distribution**: キーチェーンに存在し、`package.json`で指定済み
– ✅ **Mac Installer Distribution (3rd Party Mac Developer Installer)**: キーチェーンに存在
– ⚠️ `security find-identity -v -p codesigning`では表示されないが、キーチェーンアクセスには表示される
“`bash
npm run build:mas
“`
これで`release/mas-arm64/`に`.pkg`ファイルが生成されます。
`identity`を明示的に指定しています:
“`json
“identity”: “Apple Distribution: Akira Hattori (45J6U33V86)”
“`
1. **メインアプリにはentitlementsが適用されている**が、**ヘルパーアプリ(Helper apps)に適用されていない**
2. `entitlementsInherit`を設定しているにもかかわらず、ヘルパーアプリに`com.apple.security.app-sandbox`が適用されていない
3. `electron-builder`の`mas`ターゲットを使用しているが、ヘルパーアプリへのentitlements適用が正しく動作していない
### ビルド後のentitlements確認
以下のコマンドでヘルパーアプリのentitlementsを確認しましたが、結果はまだ確認していません:
“`bash
codesign -d –entitlements – release/mas-arm64/Sonivium.app/Contents/Frameworks/Sonivium\ Helper\ \(GPU\).app/Contents/MacOS/Sonivium\ Helper\ \(GPU\)
“`
– [Electron公式ドキュメント – Mac App Store Submission Guide](https://www.electronjs.org/ja/docs/latest/tutorial/mac-app-store-submission-guide)
– [electron-builder公式ドキュメント](https://www.electron.build/)
– [Qiita – ElectronアプリをMac AppStoreに登録する](https://qiita.com/bontaro_1/items/cbe29883900740eb9859)
1. **なぜ`entitlementsInherit`が機能しないのか?**
– `electron-builder`の`mas`ターゲットで、ヘルパーアプリにentitlementsを適用する正しい方法は?
2. **代替手段はあるか?**
– `electron-builder`の設定以外で、ヘルパーアプリにentitlementsを適用する方法は?
– ビルド後に手動でentitlementsを適用する方法は?
3. **設定の見落としはないか?**
– `package.json`の`mas`設定に不足している設定はないか?
– `entitlements.mas.plist`に不足している設定はないか?
4. **electron-builderのバージョン問題?**
– `electron-builder` 25.1.8で既知の問題はあるか?
– 他のバージョンで解決した事例はあるか?
5. **Electron 39.2.7との互換性**
– Electron 39.2.7と`electron-builder` 25.1.8の組み合わせで問題はないか?
– ビルドは成功し、`.pkg`ファイルは生成される
– コード署名も成功している(`identity`を指定しているため)
– App Store Connectへのアップロードは成功するが、バリデーションでエラーが発生する
この問題を解決するためのアドバイスや、同様の問題を経験された方の解決方法を教えていただけると助かります。
特に、`electron-builder`の`mas`ターゲットで、Electronアプリのヘルパーアプリに確実にentitlementsを適用する方法について、具体的な解決策を求めています。
coiai
この記事もおすすめ
株式会社coiaiは、「想像できることを美しく実現」を掲げ、XR・Web・アプリ・システム開発およびDX支援を行う会社です。 創業2022年、東京都練馬区に本社を置き、要件のヒアリングからPoC(概念実証)、本番運用まで一貫して伴走します。 まずはお気軽にご相談ください。
主なご相談内容
詳しい会社情報は会社概要ページでご覧いただけます。