Xcode Plugin of Jenkins not working with Xcode9.0 - ios

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"

Related

ITMS-90174: "Missing Provisioning Profile - Apps must contain a provisioning profile in a file named embedded.mobileprovision." on uploading flutter

I built a flutter app and am struggling to upload ipa file for testflight now. I built ipa file with following steps:
$ flutter build ios -t lib/main_stg.dart
Get Runner.app from step 1
Create ProjectName folder and put the app file in it
Zip ProjectName folder and rename it ProjectName.ipa
$ xcrun altool --upload-app -f ProjectName.ipa -t ios -u username -p pass
Then got the error after step 5.
*** Error: Error uploading 'ProjectName.ipa'.
*** Error: ERROR ITMS-90174: "Missing Provisioning Profile - Apps must contain a provisioning profile in a file named embedded.mobileprovision." (-18000)
I saw below page and changed "New build system" to "Legacy Build System" at Build System, but am still getting the same error:
Missing Provisioning Profile :Apps must contain a provisioning profile in a file named embedded.mobileprovision
I checked the contents of Runner.app generated at step 2 and found "embedded.mobileprovision" there. However not sure where to check for provisioning profile and how to add it if its missing.
I'm using MacOS Big sur, xcode 12.5.1, flutter 2.3.0-17.0.
You can check the Provisioning profile in Xcode like image below
I'm using Fastlane which will handle sharing provisioning profiles to your team but anyways You can go check in Xcode to see if you download and install provisioning profile correctly. If it's correct it shouldn't show any warning or errors
After reading Einzeln's answer, I checked xcode settings.
Firstly, I unticked "Automatically manage signing" and noticed similar error message "Provisioning profile xxx doesn't include signing certiicate" at "Signing Certificate" part.
I added "Apple Distribution" in Xcode->Preferences->Manage Certificates. Then added profile with "Apple Distribution" in Apple Developer Portal. At this stage (or rebooted mac was necessary?) error message was gone on xcode.
I still got the same error with xcrun command somehow. However, building from xcode GUI worked this time(It didn't work before so I decided to use command. probably because Provisioning Profile wasn't set). Then build the app->distribute done successfully.

Xcode signing using Jenkins

I am trying to sign and archive my Unity application with Jenkins. I have the Xcode jenkins plugin installed and everything seems to run well except for a strange problem.
During the xcodebuild phase, when the archive should be signed, I get the following error:
error: No signing certificate "iOS Development" found: No "iOS
Development" signing certificate matching team ID "QF6V2M666X" with a
private key was found. (in target 'Unity-iPhone')
Now the problem is that I am not trying to build for development, but for production. I have a production provisioning profile used, which is pointing the production certificate. The team id is the production team id (changed here for security reasons). Here is another part of the build output:
Going to invoke xcodebuild:, scheme: Unity-iPhone, sdk: DEFAULT,
project: DEFAULT, configuration: Release, clean: NO, archive:YES,
consolelog:YES, symRoot: DEFAULT, buildDir: DEFAULT,
developmentTeamID: QF6V2M666X
[sr-ios] $ /usr/bin/xcodebuild -scheme
Unity-iPhone -configuration Release archive -archivePath
When I open the project in Xcode, I can see that for some reason Xcode selects "IOSDeveloper" in the code signing identities part and not "IOSDistribution" (or the actual certificate in the provisioning profile):
I don't know if this can be changed from Jenkins, but I think Xcode should pick this up from the provisioning profile.
So I managed to find the problem and solve it, here is the solution for others.
In Unity 2018 they added a new option to the iOS player settings, in the "Other settings" section, called IOS Provisioning Profile->Profile type:
This option is used to select the signing identity. I guess you can use "Automatic" but in my case, since I am using Jenkins, I am setting it on a build script like this:
PlayerSettings.iOS.iOSManualProvisioningProfileType =
ProvisioningProfileType.Distribution;
When this option is set, xcode is able to sign the app correctly for distribution.

xcode9 requires a provisioning profile

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!

xcodebuild provisioning profiles not found?

I'll try to be polite talking about xCode.
Issue:
we updated provisioning profiles because prev ones are expired.
Now I can archive/build from xCode but can't using xcodebuild (which must be the same)
I did everything:
removing, adding profiles, recreating ...
reinstalling ... restarting...
removing account, adding back and a lot more
sudo xcodebuild -scheme nl.xxx.demo.iphone -workspace xxx.xcworkspace clean build
error:
=== BUILD TARGET xxxWatchAppDemo Extension OF PROJECT xxx WITH CONFIGURATION Debug ===
Check dependencies
Code Sign error: No provisioning profiles found: No non–expired provisioning profiles were found.
But when I'm archiving or building through xCode everything is just fine, and inside ipa, embedded.mobileprovision is actually our new mobileprovision with UUID d9179316-6950-4369-94dc-b7d71bba25a1
And if I explicitly set provisioning profile - it doesn't work out:
sudo xcodebuild -scheme nl.xxx.demo.iphone -workspace xxx.xcworkspace archive PROVISIONING_PROFILE=d9179316-6950-4369-94dc-b7d71bba25a1
error
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “d9179316-6950-4369-94dc-b7d71bba25a1”, however, no such provisioning profile was found.
Not found??? Really?
I checked /Users/xxx/Library/.../Provisioning Profiles/... and it's there.
I deleted it, added, repeated it 10 times, no result.
What kind of magic it is?
Any help appreciated.
Thanks
So Jenkins has been running under buildagent user, however provisioning profiles weren't found.
I created symbolic link to my
/buildagent/Library/MobileDevice/ProvisioningProfiles/ in very root folder - /Library/.
That solved my issue

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