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

ddhy6vgd  于 2022-11-15  发布在  其他
关注(0)|答案(3)|浏览(160)

昨天我们从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

(我将此问题中的应用名称替换为“应用名称”)
我已经验证了所有的证书和配置文件都是在xcode中设置的。build.json也设置好了。我不是一个真正的Mac用户,我不知道下一步该怎么做。

  • 编辑,将xcode降级到8. 3. 3修复了这个问题。不是一个理想的解决方案,但我能做的不多。
hfyxw5xn

hfyxw5xn1#

如果你像我一样明确地指定你的配置文件,比如在你的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"
    }
}

请注意iCloudContainerEnvironment =仅当您使用推送通知时才需要生产/开发

您需要明确设置手动签名并在Cordova生成的ExportOptions.plist中提供提供密钥。很遗憾,Cordova当前没有生成所有必需的密钥。
至少对我来说,它应该是这样的:

<?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>

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>

请注意,它缺少Xcode 9所需的重要位。
我通过手动归档构建生成了正确的文件,然后导出它,这也创建了exportOptions.plist,我现在将其用作参考。
深入挖掘后,我发现这在运行“Cordova add platform iOS”后无法修复,因为它是在构建阶段动态生成的。我决定分叉Cordova-ios repo并提交一个拉取请求。您可以直接使用我的分叉,也可以等到拉取请求合并后再使用。

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

分叉

拉式请求中的使用说明

请参阅下面的示例,请注意,预配配置文件可以是配置文件的名称或UUID。名称是维护的首选,因为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"
    }
}
}

我打算手动打补丁,直到/a补丁被合并到下一个Cordova版本中。你将不得不通过“Cordova platform rm iOS”和“Cordova platform add ~/forks/cordova-ios”重新生成你的iOS平台。~/forks/cordova-ios我的本地路径,使用你在本地机器上下载分叉的Cordova-ios repo的路径。

更新

cordova-ios 4.5.2已正式发布!通过运行以下命令进行升级:“ cordova 平台rm ios”,然后是“ cordova 平台添加ios@4.5.2”
干杯!干杯!

qlfbtfca

qlfbtfca2#

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

cordova platform rm ios

添加来自dev brunch的ios,其中this issue already fixed。(稍后您将能够使用ios v4.6.0或任何最终#)

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

我希望它也会对你有帮助!🙂

1aaf6o9v

1aaf6o9v3#

对于下列错误中的卫地

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

您只需要这样做就可以创建一个构建

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

更多信息:

相关问题