首页 > 解决方案 > Electron.js 应用程序公证失败,您的 Apple ID 帐户已附加到其他提供商

问题描述

我正在尝试在 Mac 上公证我的 electron.js 应用程序。代码签名成功,然后将.app文件发送到服务器进行公证,但随后该过程失败并出现错误(以下添加错误)。

从网上搜索,我发现这个问题与ascProvider字段有关。我将ProviderShortNamewith 命令xcrun altool --list-providers -u <APPLEID> -p <APP_PASSWORD>添加到ascProvider,它应该已经修复了错误,但公证过程仍然失败。

是否有任何其他可能性来解决此错误?

我从公证中得到的错误

Your Apple ID account is attached to other providers. You will need to specify which provider you intend to submit content to. Please contact us if you have questions or need help. (1627)
2021-03-01 15:00:17.378 altool[48448:1515802] *** Error: Unable to notarize app.
2021-03-01 15:00:17.378 altool[48448:1515802] *** Error: code 1627 (Your Apple ID account is attached to other providers. You will need to specify which provider you intend to submit content to. Please contact us if you have questions or need help. (1627))

notarizing.js的是这样的

require('dotenv').config();
const { notarize } = require('electron-notarize');
const fs = require('fs');
const path = require('path');

exports.default = async function notarizing(params) {
  const { electronPlatformName, appOutDir } = params;
  if (electronPlatformName !== 'darwin') {
    return;
  }

  console.log('afterSign hook triggered', params.targets);
  // Same appId in electron-builder.  
  let appId = 'my.app.com'
  let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
  if (!fs.existsSync(appPath)) {
    throw new Error(`Cannot find application at: ${appPath}`);
  }

  console.log(`Notarizing ${appId} found at ${appPath}`);

  try {
    await notarize({
      appBundleId: appId,
      appPath: appPath,
      appleId: process.env.APPLEID,
      appleIdPassword: process.env.APPLEIDPASS,
      ascProvider: process.env.APPLEPROVIDER,
    });
  } catch (error) {
    console.error(error);
  }

  console.log(`Done notarizing ${appId}`);
};

标签: macoselectroncodesignnotarize

解决方案


推荐阅读