ios 升级到 xcode 9 后,cordova 应用程序无法构建,错误 70,需要配置文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46344443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:30:46  来源:igfitidea点击:

After upgrading to xcode 9, cordova app won't build, error 70, requires provisioning profile

iosxcodecordova

提问by Trevor

Yesterday we upgraded from xcode 8.3.2 to version 9. And now our enterprise distribution apache cordova ios app refuses to build.

昨天我们从 xcode 8.3.2 升级到版本 9。现在我们的企业发行版 apache cordova ios 应用程序拒绝构建。

2017-09-21 07:37:16.787 xcodebuild[70400:217569] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/wj/yj3cfvh954gbc_btlhcrcx7nk7t4dj/T/App Name_2017-09-21_07-37-16.786.xcdistributionlogs'.
2017-09-21 07:37:16.938 xcodebuild[70400:217569] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff756bbdf70>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
    "Error Domain=IDEProvisioningErrorDomain Code=9 \"\"App Name.app\" requires a provisioning profile.\" UserInfo={NSLocalizedDescription=\"App Name.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}"
)}
error: exportArchive: "App Name.app" requires a provisioning profile.

Error Domain=IDEProvisioningErrorDomain Code=9 ""App Name.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="App Name.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}

** EXPORT FAILED **

Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,App Name.xcarchive,-exportOptionsPlist,/Users/Shared/Workspace/github/AppName/platforms/ios/exportOptions.plist,-exportPath,/Users/Shared/Workspace/github/AppName/platforms/ios/build/device

(I replaced the apps name with "App Name" for this question)

(对于这个问题,我用“应用程序名称”替换了应用程序名称)

I have verified that all the certs and provisioning profiles are set in xcode. And the build.json is set. I'm not really a Mac guy and I'm stumped on what to do next.

我已经验证所有证书和配置文件都在 xcode 中设置。并设置了 build.json。我不是一个真正的 Mac 人,我对接下来要做什么感到困惑。

-Edit, Downgrading xcode to 8.3.3 fixed the problem. Not an ideal solution but not much I can do.

- 编辑,将 xcode 降级到 8.3.3 修复了该问题。不是一个理想的解决方案,但我无能为力。

回答by Jerry Horton

If you specify your provisioning profile explicitly, like me. Like this in your Cordova build.json:

如果您像我一样明确指定您的配置文件。在你的 Cordova build.json 中是这样的:

"ios": {
    "debug": {
        "codeSignIdentitiy": "iPhone Developer",
        "developmentTeam":"MYTEAMID",
        "packageType": "developer",
        "iCloudContainerEnvironment": "Development"
    },
    "release": {
        "codeSignIdentitiy": "iPhone Distribution",
        "developmentTeam":"MYTEAMID",
        "provisioningProfile": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "packageType": "ad-hoc",
        "iCloudContainerEnvironment": "Production"
    }
}

Please NoteiCloudContainerEnvironment = Production/Development is only required if you use push notifications

请注意iCloudContainerEnvironment = Production/Development 仅当您使用推送通知时才需要

You need to explicitly set manual signing and provide the provisioning keys in your ExportOptions.plist that is generated by Cordova. Unfortunately Cordova is not currently generating all of the required keys.

您需要在 Cordova 生成的 ExportOptions.plist 中明确设置手动签名并提供配置密钥。不幸的是,Cordova 当前并未生成所有必需的密钥。

Here is what it needs to look like, at least for me:

这是它需要的样子,至少对我来说:

<?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>compileBitcode</key>
  <false/>
  <key>method</key>
  <string>ad-hoc</string>
  <key>iCloudContainerEnvironment</key >
  <string>Production</string>
  <key>provisioningProfiles</key>
  <dict>
    <key>my.bundle.idenifier</key>
    <string>My Provisioning Profile Name</string>
  </dict>
  <key>signingCertificate</key>
  <string>iPhone Distribution</string>
  <key>signingStyle</key>
  <string>manual</string>
  <key>stripSwiftSymbols</key>
  <true/>
  <key>teamID</key>
  <string>YOURTEAMID</string>
  <key>thinning</key>
  <string>&lt;none&gt;</string>
</dict>
</plist>

The file Cordova generates @ cordova/app/platforms/ios/exportOptions.plist looks like:

Cordova 生成的文件 @cordova/app/platforms/ios/exportOptions.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>compileBitcode</key>
    <false/>
    <key>method</key>
    <string>development</string>
    <key>teamID</key>
    <string>MYTEAMID</string>
  </dict>
</plist>

notice it is missing the important bits that Xcode 9 requires.

请注意,它缺少 Xcode 9 所需的重要位。

I generated the correct file by archiving the build manually, then exporting it which also creates the exportOptions.plist that I now use as reference.

我通过手动归档构建生成了正确的文件,然后将其导出,这也创建了我现在用作参考的 exportOptions.plist。

After digging deeper, I found that this cannot be fixed after running "Cordova add platform iOS", because it is generated during the build phase dynamically. I decided to fork the Cordova-ios repo and submit a pull request. You may use my fork directly, or wait until the pull request is merged.

深入挖掘后,我发现运行“Cordova add platform iOS”后无法修复此问题,因为它是在构建阶段动态生成的。我决定分叉 Cordova-ios 存储库并提交拉取请求。你可以直接使用我的fork,也可以等到pull request合并后。

Pull Requesthttps://github.com/apache/cordova-ios/pull/338/commits

拉取请求https://github.com/apache/cordova-ios/pull/338/commits

Forkhttps://github.com/jrryhrtn/cordova-ios

https://github.com/jrryhrtn/cordova-ios

Usage notes from pull request

拉取请求的使用说明

See example below, please note that the provisioning profile can be the name or UUID of the profile. Name is preferred for maintenence, as UUID changes each time to regenerate the profile.

请参见下面的示例,请注意配置文件可以是配置文件的名称或 UUID。Name 是维护的首选,因为 UUID 每次都会更改以重新生成配置文件。

{
"ios": {
    "debug": {
        "codeSignIdentity": "iPhone Developer",
        "developmentTeam":"YOURTEAMID",
        "provisioningProfile": "provisioning profile name or UUID",
        "packageType": "development"
    },
    "release": {
        "codeSignIdentity": "iPhone Distribution",
        "developmentTeam":"YOURTEAMID",
        "provisioningProfile": "provisioning profile name or UUID",
        "packageType": "ad-hoc"
    }
}
}

I plan to manually patch until the/a fix is merged into the next Cordova release. You will have to regenerate your iOS platform after the patch via "Cordova platform rm iOS" and then "Cordova platform add ~/forks/cordova-ios". ~/forks/cordova-ios my local path, use the path on your local machine where you downloaded the forked Cordova-ios repo.

我计划手动修补,直到/a 修复程序合并到下一个 Cordova 版本中。您必须在补丁后通过“Cordova platform rm iOS”和“Cordova platform add ~/forks/cordova-ios”重新生成您的iOS平台。~/forks/cordova-ios 我的本地路径,使用您下载分叉 Cordova-ios 存储库的本地计算机上的路径。

Update

更新

cordova-ios 4.5.2 has been officially released! Upgrade by running the following commands: "cordova platform rm ios", and then "cordova platform add [email protected]"

cordova-ios 4.5.2 已经正式发布!通过运行以下命令升级:“cordova platform rm ios”,然后“cordova platform add [email protected]

Cheers!

干杯!

回答by Pavel Kovalev

While help is coming and you don't want to use Xcode directly (and I don't judge you )... here is a temporary solution which worked fine for me:

虽然帮助即将到来,但您不想直接使用 Xcode(我不会评判您)……这里有一个临时解决方案,对我来说效果很好:

remove ios

删除ios

cordova platform rm ios

add ios from dev brunch where this issue already fixed. (Later you will be able to use ios v4.6.0 or whatever final # is going to be)

从 dev brunch 添加 ios,该问题已经解决。(稍后您将能够使用 ios v4.6.0 或任何最终的 # 将是)

cordova platform add https://github.com/apache/cordova-ios.git

I hope it will help you too!

我希望它也能帮助你!

回答by michelepatrassi

For who land of the following error

对于谁土地以下错误

error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided

All you need to do it this to create a build

所有你需要这样做来创建一个构建

ionic cordova build ios --prod --release -- --iCloudContainerEnvironment=Production

More info:

更多信息: