cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

Provisioning Profile not setup correctly with new build system

Open joeldhenry opened this issue 5 years ago • 40 comments

Building with the CLI: cordova build ios --device --codeSignIdentity="iPhone Developer" --provisioningProfile="NAME" --developmentTeam="TEAMID"

after upgrading to cordova-ios 5.0.0, the following error occurs:

note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: "[app-name]" requires a provisioning profile with the Push Notifications feature. Select a provisioning profile for the "Debug" build configuration in the project editor. (in target '[app-name]')

Build system information
warning: The iOS deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.1. (in target 'nanopb')

Build system information
warning: The iOS deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1. (in target 'Protobuf')

i am using a provisioning profile which contains an entitlement and my project also has the aps-entitlement.

cordova-ios 4.5.5 build fine.

joeldhenry avatar Feb 19 '19 00:02 joeldhenry

I am running into something similar, does your generated exportOptions.plist contain a provisioningProfile key which is wrapped with double quotes, like this:

<key>provisioningProfiles</key> <dict> <key>"A1B2C3D4.com.test.app"</key> <string>j23k4234-lk23423-adsa-adads-asdadasd</string> </dict>

nik0kin avatar Mar 12 '19 21:03 nik0kin

That is actually a good thing to check @nik0kin. @joeldhenry @slotto @rolandnagy?

janpio avatar Mar 14 '19 16:03 janpio

My above issue is fixed in the unreleased 5.1.0 version

nik0kin avatar Mar 14 '19 17:03 nik0kin

Is there any plans for a release date of 5.1.0 @dpogue @janpio @erisu

nik0kin avatar Mar 15 '19 15:03 nik0kin

I'm trying to move it along in my limited spare time, but I'm not going to commit to any particular timeline. I don't think I'm going to try to add anything else beyond what's already tagged in the milestone, so whenever those things are addressed I will start the release process.

dpogue avatar Mar 15 '19 16:03 dpogue

But I'm also curious what change fixed this problem... I don't see anything in master/5.0.1 that changes how the provisioning profile is set up.

dpogue avatar Mar 15 '19 16:03 dpogue

I'm getting a similar error when I build an ad-hoc, manually signed build with Xcode 10.1, iOS Cordova 5.0.0.

error: "[app-name]" requires a provisioning profile. Select a provisioning profile for the "Release" build configuration in the project editor. (in target '[target]')

I can work around this by opening the project in Xcode, and re-selecting the provisioning profile. After that, subsequent cordova CLI builds will build and archive just fine, until I delete the directory in which the xcodeproj lives. It's weird because Xcode shows the profile's name as selected, but it requires you manually re-select it from the drop down list.

Unfortunately this breaks my CircleCI builds which are building for my ad hoc devices.

Automatic provisioning works fine for my Debug builds.

joeybladb avatar Mar 28 '19 21:03 joeybladb

If it helps, I diffed the .xcodeproj file before and after.

Before:

XCBuildConfiguration section contains Debug and Release sections for each target, and these have this flag: CODE_SIGN_STYLE = Manual;

In the PBXProject section there is a ProvisioningStyle = Manual; property set.

After 're-selecting' the profile from the drop down menu:

In addition to what I describe in Before:

In the PBXProject there's an additional DevelopmentTeam property set. In the XCBuildConfiguration sections there's now a PROVISIONING_PROFILE_SPECIFIER = MyProfileName; property.

joeybladb avatar Mar 28 '19 22:03 joeybladb

I solved this issue by opening the project in XCode and selecting a team/provisioning profile.

Previously, I didn't have to do this step.

JKershaw avatar Apr 07 '19 09:04 JKershaw

Sadly this is not possible for CI triggered builds

Tallyb avatar Apr 07 '19 09:04 Tallyb

@joeldhenry or has anyone else figured out a way to work around this without manual intervention, i.e.: in a way compatible with build servers?

jskrepnek avatar Apr 09 '19 14:04 jskrepnek

@dpogue I think that @nik0kin is saying that his issue with the double quotes is fixed in master, but not necessarily the issue described by @joeldhenry?

jskrepnek avatar Apr 09 '19 15:04 jskrepnek

I have the same problem. Is there a solution?

auron105 avatar Aug 05 '19 03:08 auron105

Here is the workaround for now: use the UUID instead of the profile provision name https://github.com/apache/cordova-ios/issues/625

GODBS avatar Sep 04 '19 16:09 GODBS

I also ran into this issue recently when updating from 4.5.5 to 5.0.1.

I have managed to resolve the issue in my particular situation by removing the branch-cordova-sdk 3.2 from my project.

I am going to dig in further today to see why removing branch resolves the issue, but before I do it would be nice to see a show of hands from others that have experienced this issue, if they also use the branch sdk as well?

kiwi-josh avatar Sep 10 '19 21:09 kiwi-josh

I resolved my issue in two different ways: by forking the branch-sdk and:

  1. Removing the explicit code signing identity configuration: https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/pull/577
  2. Explicitly setting the code signing identity correctly based off the release type (Debug/Release): https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/pull/578

Hope this is helpful for others

kiwi-josh avatar Sep 12 '19 00:09 kiwi-josh

Hay Peeps,

So... I've been having the same issue where my release build was not building as it was trying to use the dev time cert (and banging head on wall for a week or so)

I've now pined down the culprit, at least for my use case thanks to this thread, but writing it up here incase it helps anyone else in the same bucket of crud!

Basically I have an Ionic 3 build that was working until I updated cordova-ios (5.0.1) to the latest version (may have also updated branch-cordova-sdk (version 3.2.0) but can't remember of the top of my head)

While https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/pull/577/files has not been merged, I've been able to identify it as a fix locally by modifying my node-package scripts.

As a fix for now.. I have stored the modified version of the enableEntitlements.js script and add the following in my beta fastlane to hack around the issue until something better is in place!

FileUtils.cp_r '../resources/branh-enableEntitlements.js', '../node_modules/branch-cordova-sdk/src/scripts/ios/enableEntitlements.js'
FileUtils.remove_dir '../platforms', true
FileUtils.remove_dir '../plugins', true
sh "(cd .. && ionic cordova build ios -- --buildConfig='#{ENV['BITRISE_CORDOVA_BUILD_CONFIGURATION']}' --buildFlag='-UseModernBuildSystem=0' --device --release --verbose)"

andycwk avatar Nov 07 '19 17:11 andycwk

Can I have an update on this? im on cordova-ios 5.1.1 and still have this iossue. I can fix the issue by using --provisioningProfile="[UUID]" as suggested by @GODBS , but this a pretty annoying solution, since every regeneration of a provisioning profile will require a build change, as apposed to using the the provisioning profile name which doesnt have to change

joeldhenry avatar Dec 17 '19 22:12 joeldhenry

I have a similar (but slightly different) issue for manual signing on [email protected]. The build-extras.xcconfig file incorrectly is set up with PROVISIONING_PROFILE when it should be PROVISIONING_PROFILE_SPECIFIER.

This is done by build.js in /bin/templates/scripts/cordova/lib/build.js

By amending that code once the ios is installed, I can get the build to work locally with Xcode 11.4 and in my Travis build with Xcode 11.3: https://github.com/Freegle/iznik-nuxt/blob/app-ios/.travis.yml with this crucial line:

- sed -i '' "s/PROVISIONING_PROFILE =/PROVISIONING_PROFILE_SPECIFIER =/" platforms/ios/cordova/lib/build.js

I can do a PR to fix this one, if it looks right for everyone.

chriscant avatar Apr 08 '20 12:04 chriscant

@chriscant I would definitely appreciate a PR for that! Unfortunately I don't have a good setup for testing manual signing, but from what I've read it sounds like that's the right approach.

If we moved from PROVISIONING_PROFILE to PROVISIONING_PROFILE_SPECIFIER, will that still work for people who are using UUIDs, or do we need to try to handle both cases?

dpogue avatar Apr 08 '20 16:04 dpogue

@dpogue I've tested with a UUID instead of a name and it works for me. My fix might have been what's been necessary all along to fix this issue, but it would be good if others could test it.

I've done a first Apache Cordova PR here - let me know if you need an ICLA done etc. https://github.com/apache/cordova-ios/pull/823

chriscant avatar Apr 08 '20 20:04 chriscant

@dpogue I've tested with a UUID instead of a name and it works for me. My fix might have been what's been necessary all along to fix this issue, but it would be good if others could test it.

I've done a first Apache Cordova PR here - let me know if you need an ICLA done etc. #823

I change my cordova-ios version to 5.1.1 from 4.5.5 for WKWebView API iOS update but I got an issue in code snippet 1. @chriscant I tried your changes in \platforms\ios\cordova\lib in the code snippet 2 below but not works on me got the same issue also in code snippet 1 and suddenly my remotebuild stop in figure 1 for details. Btw, I used manage signing certificate in my build.json file.

Severity Code Description Error Remote build error from the build server http://<ip address>:3000/cordova - Build failed with error Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,<app name>.xcarchive,-exportOptionsPlist, /Users/<Mac PC user>/.taco_home/remote-builds/taco- remote/builds/1094/cordovaApp /platforms/ios/exportOptions.plist,-exportPath,/Users/<Mac PC user>/.taco_home /remote-builds/taco-remote/builds/1094/cordovaApp/platforms/ios/build/device Project <Project Title> Code snippet 1. Build error for 5.1.1 version in VS 2017

` if (buildOpts.codeSignResourceRules) { extraConfig += 'CODE_SIGN_RESOURCE_RULES_PATH = ' + buildOpts.codeSignResourceRules + '\n'; }

if (buildOpts.provisioningProfile) { extraConfig += 'PROVISIONING_PROFILE_SPECIFIER = ' + buildOpts.provisioningProfile + '\n'; }

if (buildOpts.developmentTeam) { extraConfig += 'DEVELOPMENT_TEAM = ' + buildOpts.developmentTeam + '\n'; }` Code snippet 2. Code changes in build.js

iOSRemoteBuildError Figure 1. Remotebuild suddenly stop in Mac

Platform I used Xcode 10.1 VS 2017 Cordova 9.0.0

Cordova plugins on my project: $ cordova plugin ls cordova-plugin-device 2.0.3 "Device" cordova-plugin-dialogs 2.0.2 "Notification" cordova-plugin-file 6.0.2 "File" cordova-plugin-file-opener2 3.0.0 "File Opener2" cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard" cordova-plugin-network-information 2.0.2 "Network Information" cordova-plugin-splashscreen 5.0.3 "Splashscreen" cordova-plugin-whitelist 1.3.4 "Whitelist" cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine"

I hope you reply to me soon @dpogue and @chriscant, let me know if you need additional information on my issue. Thanks in advance!

pepenemo avatar Apr 22 '20 22:04 pepenemo

@pepenemo My changes only help if using manual signing eg --automaticProvisioning="false" or equivalent in build.json. What's in your build.json? Getting the codeSignIdentity, packageType and provisioningProfile right is crucial - and seems to be tricky.

Can you see what's at the end of the log file? It seems like it stops quite quickly. Does it hang up? Or die with an error? The screenshot mentions vcordova 6.5.0 - what's that?

It would be useful to try it directly in the remote mac, not via remotebuild. Can you try that?

You might well need to be using Xcode 11.x on the Mac.

chriscant avatar Apr 23 '20 08:04 chriscant

@pepenemo My changes only help if using manual signing eg --automaticProvisioning="false" or equivalent in build.json. What's in your build.json? Getting the codeSignIdentity, packageType and provisioningProfile right is crucial - and seems to be tricky.

@chriscant my build.json code in /build.json. `
"ios": { "debug": { "codeSignIdentity": "iPhone Developer: <Team Project Name>", "developmentTeam": "<Team ID>", "provisioningProfile": "", "packageType": "development", "buildFlag": "-UseModernBuildSystem=0" }, "release": { "codeSignIdentity": "iPhone Distribution: <Team Project Name>", "packageType": "app-store", "provisioningProfile": "", "developmentTeam": "<Team ID>", "buildFlag": "-UseModernBuildSystem=0" } } }

`

Can you see what's at the end of the log file? It seems like it stops quite quickly. Does it hang up? Or die with an error?

OutputRuntimeErrorInVS2017.txt in my VS2017 Output window...

The screenshot mentions vcordova 6.5.0 - what's that?

image it is the auto-generated setting build-in tools for apache cordova in VS 2017 -

It would be useful to try it directly in the remote mac, not via remotebuild. Can you try that?

I forgot to mention that my set-up to my project is running in windows 10 using my laptop and I used the remotebuild in this guide - https://docs.microsoft.com/en-us/visualstudio/cross-platform/tools-for-cordova/?view=toolsforcordova-2017 and I used MacOS High Sierra and had iPad connected on it which iOS version 9.3.5 . I don't know the set-up using remote mac or just a miss communication between us.

You might well need to be using Xcode 11.x on the Mac.

I will try it now if it working in cordova-ios new version. Thanks for the help and I hope you reply me again asap.

pepenemo avatar Apr 23 '20 09:04 pepenemo

For additional information my project is working on [email protected] but when I tried to switch to the 5.1.1 got an issue...

pepenemo avatar Apr 23 '20 10:04 pepenemo

@pepenemo I had worked out that that was your set up. I do use VC2017 on Windows but build Android by hand and don't use its remote build for iOS.

I get error code 70 when an incorrect provisioning profile is selected (but I don't know if 70 means only this).

It would be helpful to know about the Mac that you are building on. I presume that the provisioning profiles are installed already. I guess you must be using automatic provisioning. In this case, I don't know how much of the build.json settings are actually used.

Nonetheless, I'd say that codeSignIdentity should be exactly "iPhone Distribution" or "iPhone Developer" and your developmentTeam and provisioningProfile shouldn't be blank (unless you've redacted them). With the latest cordova-ios you don't need the legacy build system.

Are there any other options apart from from 6.5.0?

It always seems to be a pain setting this stuff to work. If you can get a screen on the Mac that might help.

chriscant avatar Apr 23 '20 10:04 chriscant

@chriscant I take a screenshot on Mac at fyi I redacted my provisioning profile...

my code content in <--project name-->/build.json file. "ios": { "debug": { "codeSignIdentity": "iPhone Developer: <--Team Project Name-->", "developmentTeam": "<--Team ID>", "provisioningProfile": "<--provisioning-profile-code-->", "packageType": "development", "buildFlag": "-UseModernBuildSystem=0" }, "release": { "codeSignIdentity": "iPhone Distribution: <--Team Project Name-->", "packageType": "app-store", "provisioningProfile": "<--provisioning-profile-code-->", "developmentTeam": "<--Team ID-->", "buildFlag": "-UseModernBuildSystem=0" } } }

pepenemo avatar Apr 23 '20 11:04 pepenemo

@pepenemo OK. I wouldn't include the team project name in the codesignidentity. Just have it as exactly "iPhone Distribution" or "iPhone Developer".

chriscant avatar Apr 23 '20 11:04 chriscant

@chriscant I try it now thanks...

pepenemo avatar Apr 23 '20 11:04 pepenemo

@chriscant I got same issue again in the ss below by trying "iPhone Developer" in 'codeSignIdentity' in build.json for running debug... BuildErrorAgain

OutputRuntimeBuildErrorLog.txt runtime error logs for additional information.

pepenemo avatar Apr 23 '20 12:04 pepenemo