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

前端 未结 3 2061
终归单人心
终归单人心 2020-11-29 02:19

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

2017-09-21 07:37:16.787 xc         


        
相关标签:
3条回答
  • 2020-11-29 02:28

    While help is coming and you don't want to use Xcode directly (and I don't judge you

    0 讨论(0)
  • 2020-11-29 02:29

    If you specify your provisioning profile explicitly, like me. Like this in your 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 Note iCloudContainerEnvironment = Production/Development is only required if you use push notifications

    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.

    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:

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

    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.

    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.

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

    Fork 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.

    {
    "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.

    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 ios@4.5.2"

    Cheers!

    0 讨论(0)
  • 2020-11-29 02:47

    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:

    • https://medium.com/@michele.patrassi/https-medium-com-michele-patrassi-add-icloud-icloudcontainerenvironment-to-your-ionic-ios-app-227300bf8896
    0 讨论(0)
提交回复
热议问题