Export archive error for Xcode project containing app clip - ios

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.

Related

building kivy app for ios fails (no teamID)

I created a simple app using python 3.8.10 / kivy and was able to build and deploy an Android apk. I am now trying to build it for iOS. Following are installed.. using homebrew: autoconf automake libtool pkg-config. using pip: Cython==0.29.28, kivy-ios. Tried two approaches (maybe they are the same under the covers...newbie here)
Ran buildozer ios debug. When I initially ran this it was giving me errors about missing libraries which I installed and kept going. I have also wiped out the .buildozer directory to get a fresh install. About 20mins after the build process I got an error saying ios.codesign.debug was not filled in. I thought that was odd given that this was set ios.codesign.allowed = false. I followed the instructions in a this SO post to get the developer certificate.
When I then try the same command I get the following error
# Creating IPA...
# Run 'xcodebuild -exportArchive -archivePath "/Users/<snip>/MyApp/.buildozer/ios/platform/kivy-ios/MyApp-0.1.intermediates/MyApp-0.1.xcarchive" -exportOptionsPlist "/Users/<snip>/MyApp/.buildozer/ios/platform/kivy-ios/MyApp-ios/MyApp-Info.plist" -exportPath "/Users/<snip>/MyApp/.buildozer/ios/platform/kivy-ios/MyApp-0.1.intermediates/MyApp-0.1.ipa" CODE_SIGN_IDENTITY="Apple Development: nori.sangeeta#gmail.com (AX6CHB96V5)" ENABLE_BITCODE=NO'
# Cwd /Users/<snip>/MyApp/.buildozer/ios/platform/kivy-ios/MyApp-ios
2022-12-07 02:52:29.932 xcodebuild[4687:2833519] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/4k/q9h0y35d5f775bw_07lngvrr0000gs/T/MyApp_2022-12-07_02-52-29.930.xcdistributionlogs".
** EXPORT FAILED **
error: exportArchive: No "teamID" specified and no team ID found in the archive
Error Domain=IDEFoundationErrorDomain Code=1 "No "teamID" specified and no team ID found in the archive" UserInfo={NSLocalizedDescription=No "teamID" specified and no team ID found in the archive}
I took that to assume that ios.codesign.development_team.debug = <hexstring> has to be filled in but I have no idea what to put there! I tired "Personal Team" / same hex string as above, neither worked.
Following the instructions here
I am able to open xcode using open myapp-ios/myapp.xcodeproj but when I click on play, I don't get to "enjoy"(!), it tries to build and I eventually get an error.
The developer account is not a paid account and this is a simple prototype preferable without the need for codesign etc. If/when compiled, the app will be run on just 1 iPhone 13!!
Any thoughts?

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!

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.

Xcode: Can I set Code Signing Profile from the command line

I have a batch build script that I run to build a common codebase for iOS apps into 100+ unique IPAs. I use Xcode 4.2 on OS X Lion.
The build settings for each app are set using PlistBuddy and the build works by running
PlistBuddy, installing app icons, running xcodebuild, then xcrun. It has been tested and
works correctly when targeting a single app.
Each app has a unique distribution provisioning profile that currently must be manually assigned via Xcode's Project settings -> Code Signing section (for release builds).
My problem is that the build script will not be able to match the App to its profile during the xcodebuild phase. It will simply try to use the most recent app's profile, then generate the error:
[BEROR]Code Sign error: Provisioning profile 'MOST RECENT APP'S PROVISIONING PROFILE ID HERE' can't be found.
Desperately looking for a way to either set this via command line (security, plistbuddy, or xcodebuild?). My batch script is quite useless without it.
I found the answer - it was simple. The problem was that in my Xcode target Code Signing settings, I had set a specific distribution profile for the build (out of 90 or so).
What fixed it was simply selecting the profile under "Automatic Profile selection".
Once that was done, xcodebuild was able to run successfully.

Resources