Electron 打包的mas ,上传Mac App Store之后,Testflight 显示“ 尚无法测试”

上篇文章请看这里  Electron 打包 Mac App Store 应用,苹果开发者证书的配置、上传

第一次提交 Electron 的应用到 Mac App Store,如果你注意到TestGlight选项下,你上传的应用显示"尚无法测试",这个可能会是有问题的,苹果没有给出更多的提示信息,所以很难知道是哪里出了问题。错误如下图所示:

CleanShot 2023-06-07 at 14.41.42@2x.png

当你忽略这个,把应用提交审核,第二天可能就收到了被拒的消息。

比较诡异的是,Apple 为啥知道你的应用不能跑起来,但是可以提交审核呢?

苹果的审核时间已经比起几年前动辄一周快了好多,但是如果我们的应用在提交审核之前,没有用TestFlight 充分测试的话,这一来一回估计得花好久时间。导致我们的精力不能从这件事情上移开。

一开始解决的思路是从苹果的证书出发,重新配置证书,打包等操作。尝试了很多遍都是同样的结果。也没有更好的思路,如果以TestFlight 尚无法测试 词条搜索的话,基本上搜索不到有用的信息。

通过 ChatGPT 4 也得不到有效信息,全是那种很泛的检查步骤。

当我换了一台电脑,从头配置了一次证书还是没有解决之后,还是没有解决问题。

查找苹果的官方文档查看构建版本状态和指标 - 测试 Beta 版本 - App Store Connect - 帮助 - Apple DeveloperApp build statuses - Reference - App Store Connect - Help - Apple Developer可以看到只有两个<span style='color:#eb3b5a'>红色</span>的状态
CleanShot 2023-06-09 at 10.26.10@2x.png
CleanShot 2023-06-09 at 10.26.18@2x.png
明显咱们遇到的情况不属于上面的第二种情况,那么属于第一种,但是还是没有多余的信息,来解决问题。
不过从这个状态文档可以知道,“<span style='color:#eb3b5a'>尚无法测试</span>”这种红色的状态肯定是有问题的。

此时我想到用英文搜索,但是尚无法测试 苹果官方是显示的是什么,是<span style='color:#fa8231'> "Cannot be tested yet. ",</span> 还是<span style='color:#fa8231'>"Not yet testable"</span>,因为我的界面是中文的(用中文被坑,多花了不少搜索时间,其实苹果显示的是<span style='color:#20bf6b'>"Not Available for Testing"</span>),所以不清楚,就随便搜着试了试,经过一步步的查找,在 Github 上找到了一个 Issue,Electron MacOS app 'Not Available for Testing' in Testflight · Issue #6856 · electron-userland/electron-builder · GitHub
顺着这个思路,我在 build 配置中添加了"hardenedRuntime": false,"entitlementsLoginHelper": "build/entitlements.mas.loginhelper.plist"
问题得到了解决。

再次上传,看到了"准备提交"的字样。

CleanShot 2023-06-07 at 14.45.11@2x.png

具体的配置如下
在electron-build 配置中:


  build: {
    buildVersion: "1",
    files: ["**"],
    extends: null,
    productName: "GitHeat",
    appId: "com.xxxxxx.xxxxxx",
    asar: true,
    mac: {
      target: [{
        target: 'mas',
        arch: ['universal']
      },
      {
        target: 'dmg',
        arch: ['universal'],  // ['x64', 'arm64']
      }],
      hardenedRuntime: true,
      gatekeeperAssess: false,
      category: 'public.app-category.utilities',
      minimumSystemVersion: '12.0',  // set minimum system version to 12.0 or higher
      
    },
    mas: {
      hardenedRuntime: false,
      type: "distribution",
      entitlements: 'build/parent.plist', // specify the path to the parent entitlements file
      entitlementsInherit: 'build/child.plist', // specify the path to the child entitlements file  
      entitlementsLoginHelper: "build/entitlements.mas.loginhelper.plist",
      provisioningProfile: 'build/embedded.provisionprofile'
      
    },
  }

parent.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.files.user-selected.read-only</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.application-groups</key>
    <string>TEAMID.com.app.appname</string>
    <key>com.apple.developer.team-identifier</key>
    <string>TEAMID</string>
  </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>

entitlements.mas.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>

最后,当前版本的 MacOS, 还是不建议将hardenedRuntime 设置为 false,但是没办法。


已发布

分类

作者:

标签

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注