Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning Profile not setup correctly with new build system #536

Closed
joeldhenry opened this issue Feb 19, 2019 · 40 comments · Fixed by #1405
Closed

Provisioning Profile not setup correctly with new build system #536

joeldhenry opened this issue Feb 19, 2019 · 40 comments · Fixed by #1405

Comments

@joeldhenry
Copy link

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.

@nik0kin
Copy link

nik0kin commented Mar 12, 2019

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>

@janpio
Copy link
Member

janpio commented Mar 14, 2019

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

@nik0kin
Copy link

nik0kin commented Mar 14, 2019

My above issue is fixed in the unreleased 5.1.0 version

@nik0kin
Copy link

nik0kin commented Mar 15, 2019

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

@dpogue
Copy link
Member

dpogue commented Mar 15, 2019

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
Copy link
Member

dpogue commented Mar 15, 2019

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.

@joeybladb
Copy link

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
Copy link

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.

@JKershaw
Copy link

JKershaw commented Apr 7, 2019

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.

@Tallyb
Copy link

Tallyb commented Apr 7, 2019

Sadly this is not possible for CI triggered builds

@jskrepnek
Copy link

@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
Copy link

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

@auron105
Copy link

auron105 commented Aug 5, 2019

I have the same problem.
Is there a solution?

@GODBS
Copy link

GODBS commented Sep 4, 2019

Here is the workaround for now: use the UUID instead of the profile provision name
#625

@kiwi-josh
Copy link

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 added a commit to kiwi-josh/cordova-ionic-phonegap-branch-deep-linking-attribution that referenced this issue Sep 11, 2019
… 9.0.0 by defining either the Developer or Distribution identities depending on the configuration config name (Release/Debug)

Without this change distribution builds are configured to attempt a build with a debug/developer signing cert: apache/cordova-ios#536 (comment)
kiwi-josh added a commit to kiwi-josh/cordova-ionic-phonegap-branch-deep-linking-attribution that referenced this issue Sep 12, 2019
… 9.0.0 by removing the explicit declaration of the code sign identity in the enableEntitlements script

Without this change distribution builds are configured to attempt a build with a debug/developer signing cert: apache/cordova-ios#536 (comment)
@kiwi-josh
Copy link

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

  1. Removing the explicit code signing identity configuration: Option 1: Remove the explicit declaration of the code sign identity BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution#577
  2. Explicitly setting the code signing identity correctly based off the release type (Debug/Release): Option 2: Configure the declaration of the code sign identity correctly BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution#578

Hope this is helpful for others

@andycwk
Copy link

andycwk commented Nov 7, 2019

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)"

@joeldhenry
Copy link
Author

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

@chriscant
Copy link
Contributor

I have a similar (but slightly different) issue for manual signing on ios@5.1.1.
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.

@dpogue
Copy link
Member

dpogue commented Apr 8, 2020

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

@chriscant
Copy link
Contributor

@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

@pepenemo
Copy link

pepenemo commented Apr 22, 2020

@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!

@chriscant
Copy link
Contributor

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

@pepenemo
Copy link

pepenemo commented Apr 23, 2020

@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: ",
"developmentTeam": "",
"provisioningProfile": "",
"packageType": "development",
"buildFlag": "-UseModernBuildSystem=0"
},
"release": {
"codeSignIdentity": "iPhone Distribution: ",
"packageType": "app-store",
"provisioningProfile": "",
"developmentTeam": "",
"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
Copy link

For additional information my project is working on cordova-ios@4.5.5 but when I tried to switch to the 5.1.1 got an issue...

@chriscant
Copy link
Contributor

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

@pepenemo
Copy link

pepenemo commented Apr 23, 2020

@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"
}
}
}

@chriscant
Copy link
Contributor

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

@pepenemo
Copy link

@chriscant I try it now thanks...

@pepenemo
Copy link

pepenemo commented Apr 23, 2020

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

@chriscant
Copy link
Contributor

@pepenemo Getting the right incantations is tricky - I've spent days trying to get it right at times :-(

@pepenemo
Copy link

@chriscant thank you so much spending time on this big help :) . Btw, I added an ss below fyi in my Xcode 10.1 project running in macOS High Sierra version 10.13.6 :)

2020-04-24 00_29_51-manageSign Setting in Xcode

@chriscant
Copy link
Contributor

@pepenemo FYI: Apple say "Starting April 2020, all iOS apps submitted to the App Store must be built with the iOS 13 SDK or later, included in Xcode 11 or later."
And: "Xcode 11 requires a Mac running macOS Mojave 10.14.4 or later."
So you'll need to upgrade for the app to accepted, sorry. I had to.

@pepenemo
Copy link

pepenemo commented Apr 24, 2020

@chriscant hey thanks for the reply and info helps a lot. But my issue was building an iOS app using cordova@5.1.1 on my current Xcode version, are we able to consider the supported Xcode version mentioned in this link - https://www.npmjs.com/package/cordova-ios and ss below to emphasize because I was tried it many times (almost 2-3 weeks) but doesn't work.
supportedxcodev

@pepenemo
Copy link

@chriscant can I request your information about your Xcode XX.X.X version and macOS Mojave XX.XX.X version? that the cordova-ios@5.1.1 was able to run in your machine. So that I will update my Mac conform to your version.

I hope you reply to me soon again and thanks a lot for helping me much appreciated!

@breautek
Copy link
Contributor

Xcode 10 is what cordova supported and was tested against. Xcode 11 requirement is not a cordova requirement but an Apple requirement if you want to deploy to the iOS app store. The reason for the disconnect is not all developers build for the app store, we do have users who build apps for enterprise/in-house installations. While not explicitly mentioned in the readme, cordova-ios does work in xcode 11.

In regards to your issue at hand, I cannot really provide a comment. I let Xcode automatically manage the signing and provisions and that has always worked for me. Sometimes I need to uncheck and re-check that "automatically manage signing" box however.

@chriscant
Copy link
Contributor

@pepenemo Automatic signing is usually easier if you have access to the same Mac. To set up automatic signing for me has usually involved doing something interactively within Xcode at least once before the cordova build will work eg unchecking and checking the "automatically manage signing" box.

I had to use manual signing for my Travis build which sets up a Mac virtual machine for each build. I used several helpful articles online to get my Travis script in place: https://github.com/Freegle/iznik-nuxt/blob/app-ios/.travis.yml
This script build adhoc and app-store version of two apps (from the one source), saves the generated IPAs in a github release and uploads the release IPAs to iTunes.

I got a second hand Macbook Air (2013) which runs the latest MacOS Catalina 10.15 that runs Xcode 11.4.1.
The Travis VM runs MacOS Mojave 10.14.6 with Xcode 11.3.1.

@pepenemo
Copy link

Thank you so much @chriscant and @breautek for the support and information! Much appreciated. I will explore now the Travis VM and if it working I'll update the macOS and I'll keep posting here for my updates :)

@joeldhenry
Copy link
Author

Update: Still an issue with latest cordova-ios 6.1.0, must use UUID rather than profile filename to automate build process, which is frustrating when provisioning profile changes such as adding new devices.

@gasperinn
Copy link

gasperinn commented Mar 29, 2022

Don't know how relevant it is to you by now but i solved the problem by changing the build.json file like this (cordova-ios v6.2.0) when using cordova build ios :

{
"ios": {
"debug": {
"buildFlag": [
"PROVISIONING_PROFILE_SPECIFIER=Provisioning_profile_name",
"CODE_SIGN_STYLE=Manual"
],
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "XYZ",
"packageType": "development",
"provisioningProfile": "Provisioning_profile_name"
}
}
}

The same works with release version or/and ad-hoc profile.

  • PROVISIONING_PROFILE_SPECIFIER specifies which PP should xcodebuild use by providing the PP name (not UUID)
  • CODE_SIGN_STYLE has to be specified to "Manual", if not xcdebuild wants to use automatic signing and it throws an error
  • provisioningProfile should still be defined when using --device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.