xcode9 requires a provisioning profile - ios

I am using xcode plugin (version 2.0.1) with jenkins to generate our builds for multiple targeted app.
With Xcode 9, our jenkins build configuration is able to generate the archive but fails to create the ipa. The error message is as follows:
Error Domain=IDEProvisioningErrorDomain Code=9 ""test.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="test.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
I have already added the provisioning profile inside Jenkins Custom xcodebuild arguments section by passing the PROVISIONING_PROFILE, PROVISIONING_PROFILE_SPECIFIER, CODE_SIGN_IDENTITY, CODE_SIGN_STYLE and DEVELOPMENT_TEAM however, it still shoots the same error message. Besides, I also pass the ExportOptions.plist file in the Build phases Run script option but it seems that Xcode generates its own ExportOptions.plist(enterpriseTEAMIDExport.plist) and ignores mine. When I open enterpriseTEAMIDExport.plist file it only contains the teamid and the method of export and so, it doesn't find the provisioning profile.
So, how can I tell xcode to use my ExportOptions.plist file instead? I have followed the image here but unable to find it inside Xcode 9. Also, this post doesn't relate to me.
Another important thing is that I am able to generate the ipa using my own ExportOptions.plist file from command line xcodebuild tool using this command as follows:
xcodebuild -exportArchive -archivePath archive.xcarchive -exportPath /my/export/path -exportOptionsPlist options.plist
So, I don't know why it doesn't work with Jenkins Xcode plugin.
Any help is much appreciated.
Thanks!

Related

Export archive error for Xcode project containing app clip

We are using Jenkins to automate building of our iOS project. Everything was working just fine out of the box until we integrated App Clip into the Xcode project. The error says (I changed real bundle id):
error: exportArchive: Provide a bundle identifier to select from
available reformatters: com.example.myapp and com.example.myapp.Clip
Error Domain=IDEDistributionReformatterSelectionStepErrorDomain
Code=0 "Provide a bundle identifier to select from available reformatters:
com.example.myapp and com.example.myapp.Clip"
I created ExportOptions.plist and set distributionBundleIdentifier equal to com.example.myapp inside it. Then in Jenkins Advanced Xcode build options -> Custom xcodebuild arguments I added -exportOptionsPlist ExportOptions.plist.
Jenkins asked me to provide -exportArchive additional key. After I did it, Jenkins told that it's illegal to have scheme and exportArchive together in command line.
Does anyone have an idea how to fix it? Thanks.

xcodebuild using wrong provisioning profile

I have a bash script where I am trying to automate pushing an IPA to TestFlight. Currently this script is successfully uploading to the app-store with an ad-hoc provisioning profile and not my distribution profile as such I am unable to push the build to TestFlight as it does not have the beta-reports-active key. This is easily fixable from within XCode but I have had no luck using command line which is integral to what I want to do. This is my current command trying to use manual signing:
xcodebuild archive -workspace $NAME.xcworkspace -allowProvisioningUpdates -scheme $NAME -configuration Release -archivePath ../builds/$NAME.xcarchive DEVELOPMENT_TEAM=$TEAM_ID CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY="iOS Distribution: MY_NAME" PROVISIONING_STYLE=Manual PROVISIONING_PROFILE_SPECIFIER="PROVISIONING PROFILE "
Is there a way of getting the correct provisioning profile through command line
EDIT
Examples of what I have tried:
Downloading and inserting the provisoning profile int0 ~/Library/MobileDevice/Provisioning\ profiles and then using PROVSIONING_PROFILE_SPECIFIER to point to the profile
Inserting the app-store method into the export options plist file
Creating new ExportOptions file that specifies manual signing as well as the provision profile being used - so far getting a signing error due to no provisioning profile being found
Hope this ^ is clear
I had a similar problem, I was using fastlane to push to testflight and it automatically kept pulling the wrong provisioning profile..
When I dug deeper by running
xcodebuild -showBuildSettings -workspace Freshdesk.xcworkspace -scheme <My Build scheme>
I realised that no matter what scheme I picked I kept getting the same provisioning profile in the command line.
I then dug into xcode and chanced on this parameter
This was set to staging and I could never sign my app for the app store build, I changed it to production and it fixed my problems
You can find this under "configurations" in the info tab of your project and not the target
I hope this helps!

Xcode Plugin of Jenkins not working with Xcode9.0

I am using Xcode plugin of Jenkins which is working for Xcode 8.3 but it is not compatible with Xcode 9.0 because of changes in code signing .
I am getting the error as below :
error: exportArchive: "SwiftDemo.app" requires a provisioning profile.
Error Domain=IDEProvisioningErrorDomain Code=9 ""SwiftDemo.app" requires a provisioning profile."
UserInfo={NSLocalizedDescription="SwiftDemo.app" requires a
provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to
the "provisioningProfiles" dictionary in your Export Options property
list.}
** EXPORT FAILED **
I was also getting this error. But now solved the issue. I can build successfully in Xcode9.0 and Xcode9.2.
Here are the steps mentioned below to overcome above error.
Manually generate and export the IPA file with Xcode. This will create a file name ExportOptions.plist in the exported folder.
Copy that file to workspace root folder.
In Jenkin General build settings, uncheck “Pack application, build and sign .ipa?”, and check “Generate Archive?”.
And last, add an Execute shell like this,
xcodebuild -exportArchive -archivePath ${WORKSPACE}/build/YourProject.xcarchive -exportPath ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/archive -exportOptionsPlist ${WORKSPACE}/ExportOptions.plist
what works for me:
Keychain: Move two signing certificates (iphone dev and iphone distr) from Login to System.
make sure that "trust" property set to "system default"

ERROR ITMS-90046 using xctool / xcodebuild vs XCode Archive's success

I've got a command line script I use to compile, archive and submit my ios builds to ITC for TestFlight deployment. They work great, but I recently ran into an issue when trying to use an embedded framework within my otherwise working project. My script compiles and archives the project successfully but is getting ITC signing errors because of the embedded binary conflict.
xctool -workspace $BASE_DIR/$PROJECT_NAME -scheme $SCHEME -configuration $CONFIG clean archive -archivePath ./$PRODUCT_NAME.xcarchive
xcodebuild -exportArchive -archivePath ./$PRODUCT_NAME.xcarchive -exportPath $PRODUCT_NAME -exportFormat ipa -exportProvisioningProfile "$DIST_PROVISIONING_PROFILE_NAME"
# result is successful, with .ipa file generated
After a successful compilation my script tries to upload to ITC, and fails with the below msg. I get the same message if I try to upload the generated IPA file to ITC myself using Application Loader tool.
ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application
bundle's signature contains code signing entitlements that are not
supported on iOS. Specifically, value 'XXXXXXXXX.com.domain.Product'
for key 'application-identifier' in
'Payload/Product.app/Frameworks/Charts.framework/Charts' is not
supported. This value should be a string starting with your TEAMID,
followed by a dot '.', followed by the bundle identifier.
There is no application-identifier string used in my project or settings that I can find with a global search.
Extra Info
com.domain.Product would be my project's main bundleIdentifier, which has a distribution certificate and provisioning profile generated for it. Without the embedded binary that works just fine. The "Charts" embedded project has a bundleIdentifier but the team is set to "None" in the Info tab, and signing is set to Automatic. Since it is an embedded binary/framework, I'm assuming it doesn't independently sign it. When using Xcode's Archive, it is listed as a subset of the main Project with no independent identifier or entitlements.
I have also tried creating an independent appId and distribution provisioning profile for the embedded binary called "com.domain.ProductCharts" and setup the project correctly. This does not change the error.
I have further tried setting the embedded binary's project to use the same bundleIdentier and settings as the parent Project, but this does not change the error.
Why is xctool/xcodebuild unable to properly compile and sign this to get through to ITC, while the native Archiver can?
Currently, I encountered what I think is a bug in xcodebuild command similar to this, way I fixed it for me was to setup provisioning profile in the project settings. Try updating your project and run build again.
The investigation into the issue was here: https://forums.developer.apple.com/thread/14378
But others reported problem with associated domains:
SO question: Apple Store submit fails with Error ITMS-90046, but Associated Domains is not among entitlements
What is your OS, XCode ... etc?
Just a guess: Maybe you need to specify an application-identifier in your Entitlements.plist if you use the command line. Here https://developer.apple.com/library/ios/qa/qa1710/_index.html it is stated that in "In modern versions of Xcode.."
You said:
They work great, but I recently ran into an issue...
Have you created a new profile meanwhile and now there are two? Or two certificates? Here is a description on how to check your entitlements. Maybe this helps.
Creating .entitlements for the embedded framework will solve the issue only in Xcode 7.x. In the version 8.x the issue still exists.

Code Sign error in xcodebuild archive

I am trying to generate a .ipa file only through command line,
xcodebuild archive -project someproject.xcodeproj -scheme somescheme -
archivePath /somepath/someproject.xcarchive
This command still depends on the provisioning profile I have selected in xcode, and fails if a wrong profile is chosen.
The error generated is :
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “some UUID”, however, no such provisioning profile was found.
Is there a way I can make archive command independent of provisioning profile chosen in Xcode ? Or can this be a configurable parameter in the command. Do we have a file where this value is mentioned, in that case I can overwrite it.
It looks like you should be able to use an additional parameter on the xcodebuild command you mentioned above.
There is an additional option called exportProvisioningProfile that allows you to specify the provisioning profile to use.
From Apple Docs:
-exportProvisioningProfile profilename
Specifies the provisioning profile that should be used when exporting the archive.
Link to documentation:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html

Resources