Error: no provisioning profile matches xcode build - ios

BuilSettings[REFERENCE IMAGE1][1]I'm creating an script to automate ios build to generate .ipa ... Below is my script,
# xcodebuild -workspace "project.xcworkspace" -scheme "Schemename" clean
# xcodebuild -workspace "project.xcworkspace" -scheme "Schemename" build
# xcodebuild archive -workspace "project.xcworkspace" -scheme "schemename" -archivePath "project.xcworkspace.xcarchive"
# xcodebuild -exportArchive -archivePath "project.xcworkspace.xcarchive" -exportPath "project.xcworkspace" -exportFormat ipa -exportProvisioningProfile "Digi Form Development": *"
while executing above script getting an error of,
--- xcodebuild: WARNING: -exportArchive without -exportOptionsPlist is deprecated error: no provisioning profile matches 'Digi Form
Development: *'
** EXPORT FAILED **
Since I'm new to this ios build deployment using xcode cli kindly help me on to correct my problems,

You need to create a exportOptions.plist file, then add the command line flag as so:
-exportOptionsPlist exportOptions.plist
The export options plist should look something like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>provisioningProfiles</key>
<dict>
<key>my.bundle.idenifier</key>
<string>My Provisioning Profile Name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOURTEAMID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
Note that signing style can be manual or automatic. If you are explicitly setting the provisioning profile, which I tend to do, use manual and specify the provisioning profile name explicitly. If automatic, Xcode will try to automatically find a matching profile.
For the method field, the options are: development, ad-hoc, distribution and enterprise.
Here is a link with a more general description on this feature: http://devcenter.bitrise.io/tips-and-tricks/xcodebuild-export-options/

Related

unsigned xcarchive aps environment missing

I want to share unsigned xcarchive. To make unsigned xcarchive. I set Provisional profile and Signing Certificate as None.
I have crated Xcarchive with below commands one by one.
xcodebuild -scheme xxxx -workspace xxx.xcworkspace -configuration Release clean archive -archivePath "/Users/exxx/Desktop/PROD/xxx.xcarchive" CODE_SIGN_ENTITLEMENTS=/Users/exxx/Desktop/PROD/Cert/entitlements.plist CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
& without passing CODE_SIGN_ENTITLEMENTS
xcodebuild -scheme xxxx -workspace xxx.xcworkspace -configuration Release clean archive -archivePath "/Users/exxx/Desktop/PROD/xxx.xcarchive" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
when I upload that archive with Organizer then at final check it shows Entitlement summary where 'aps-environemt' key always missing. I have attached screen shot for reference. Both builds having same issue.
I also tried the same exported archive to codesign with entitlement but that also don't work. (With below command)
codesign --entitlements /Users/xxx/Desktop/PROD/Cert/xxx.entitlements -f -s xxx /Users/xxx/Desktop/PROD/xxx.xcarchive
When My upload completed then getting an email from apple as,
Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the 'aps-environment' entitlement...
To add APS entitlement to your xcarchive you should sign your .app file with entitlements.plist that has aps-environment key (and other needed keys) e.g.:
entitlements.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
Next sign embedded frameworks and your app file with the entitlements:
$ codesign -f -s "<codesiging identity>" -v /foo.xcarchive/Products/Application/foo.app/Frameworks/*
$ codesign -f -s "<codesiging identity>" --entitlements /pathToEntitlements/entitlements.plist /foo.xcarchive/Products/Application/foo.app
To get available codesign identities run next command:
security find-identity -vp codesigning

Missing Provisioning Profile error when archiving using xcodebuild

to automate my app build process, I am trying to build my iOS app via command line
Build command
xcodebuild archive -project sample.xcodeproj -scheme "sample" -archivePath $PWD/archive/sample.xcarchive -destination generic/platform=iOS -UseModernBuildSystem=NO
Export Command
xcodebuild -exportArchive -archivePath $PWD/archive/sample.xcarchive -exportOptionsPlist ./ExportOptions.plist -exportPath $PWD/build -UseModernBuildSystem=NO
Following is the error
Error Domain=IDEProvisioningErrorDomain Code=9 ""sample.app" requires a provisioning profile." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription="sample.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
Please note that the archive from Xcode works fine.
And the Info.plist file from archive folder archive/sample.xcarchive/Info.plist does not contain provisioning profiles dictionary.
As per other suggestions on google and StackOverflow, I have tried the following
Changed build settings to Legacy build
Removed Provisioning profiles folder from ~/Library/MobileDevice
Upgraded Xcode to latest (currently 11.4)
created a softling of ~/Library/MobileDevice in /Library/MobileDevice
Recreated provisioning profile in developer account.
Could anyone help me get over this issue?
What has finally worked is to remove wildcard while mentioning the App id in the exportOptions.plist file.
<?xml version="1.0" encoding="UTF-8"?>
<dict>
<key>provisioningProfiles</key>
<dict>
<key>APP_ID_WITHOUT_WILDCARD_CHAR</key>
<string>PROVISIOING_PROFILE_NAME_AS_SEEN_BY_XCODE</string>
</dict>
<key>method</key>
<string>app-store</string>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>TEAM_ID</string>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
I got the same error after upgrading to XCode 11.3. It's related to new Apple Development and Apple Distribution certificate types.
Edit provisioning profile and select use in Xcode 11.
Use this new provisioning profile to fix this error.

This bundle is invalid - The Info.plist file for /Payload/MyAppName.app/Sticker Pack.stickerpack is missing or could not be read

Hope you are well.
I want to add iMessage Stickers to my app.
My app created in Android Studio using LibGDX/RoboVM. So, I can't add Stickers extension directly to my project. I have signed .ipa as output from Android Studio after building with RoboVM.
I have created a single standalone project in Xcode with my app's bundle id, added the Stickers extension, then have done the following.
In the terminal
Unzipped the .ipa using "unzip MyApp.ipa".
Removed the _CodeSignature folder using "rm -rf Payload/MyApp.app/_CodeSignature/"
Copied and Pasted the Stickers extension to the "Payload/MyApp.app/"
Copied and Pasted the provisioning profile using "cp MyDistributionProfile.mobileprovision Payload/MyApp.app/embedded.mobileprovision"
Signed again using "codesign -f -s "iPhone Distribution: MyCompany INC" --entitlements Entitlements.plist Payload/MyApp.app"
Zipped using "zip -qr MyResignedApp.ipa Payload/".
After this, I tried to upload the MyResignedApp.ipa via ApplcationLoader from XCode and did not get any error during upload.
The problem is that I received the rejection email, where they said the following,
This bundle is invalid - The Info.plist file for /Payload/MyApp.app/Sticker Pack.stickerpack is missing or could not be read.
The Info.plist exists and here is it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>new_stickers</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME_)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.message-payload-provider</string>
<key>NSExtensionPrincipalClass</key>
<string>StickerBrowserViewController</string>
</dict>
Any suggestions what I'm doing wrong?
Many Many thanks.
You `Copied and Pasted the Stickers extension to the "Payload/MyApp.app/" but extension has to be located in "Payload/MyApp.app/PlugIns".
MobiVM natively supports packing and signing extension out of the box. And it is not required to manual repacking/signing.
But you have to build app extension in Xcode within standalone project, then reference extension in robovm.xml like bellow:
<appExtensions>
<extension profile="3AED05A9-5F1F-4120-9276-11980B9C88EE">OneSignalNotificationServiceExtension</extension>
</appExtensions>
To build it in Xcode easies way is to add extension target to empty project. Then build it separately from command line using xcode-build:
xcodebuild -project onesignal.xcodeproj -target OneSignalNotificationServiceExtension -configuration release -sdk iphoneos -arch arm64 -arch armv7 -arch armv7s BUILD_DIR=build BUILD_ROOT=build
xcodebuild -project onesignal.xcodeproj -target OneSignalNotificationServiceExtension -configuration release -sdk iphonesimulator -arch i386 -arch x86_64 BUILD_DIR=build BUILD_ROOT=build
and pack into fat binary using lipo.
lipo -create -output "OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension" \
"build/release-iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension" \
"build/release-iphonesimulator/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension"
Also in case of stickers extension RoboVM copies following to IPA:
MessagesApplicationExtensionSupport/MessagesApplicationExtensionStub
MessagesApplicationSupport/MessagesApplicationStub
Which might be missing when you do repacking manually.
There is a tutorial for MobiVM how to use app extension which provide more details about each step.

ERROR ITMS-90171: "Invalid Bundle Structure The binary file MyApp.app/libswiftRemoteMirror.dylib is not permitted

I'm getting below error when trying to upload my ipa which is build on Jenkins.
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'ideaPitch.app/libswiftRemoteMirror.dylib' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
How I get the ipa on Jenkins
/usr/bin/xcodebuild -list -workspace My_App.xcworkspace
/usr/bin/xcodebuild -scheme My_App -workspace My_App.xcworkspace -configuration Release clean build CONFIGURATION_BUILD_DIR=${WORKSPACE}/build -UseModernBuildSystem=0
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${WORKSPACE}/build/My_App.app" -o ${WORKSPACE}/build/My_App${PRODUCT_VERSION}-${PRODUCT_VERSION}.ipa
ditto -c -k --keepParent -rsrc "${WORKSPACE}/build/My_App.app.dSYM" ${WORKSPACE}/build/My_App-${PRODUCT_VERSION}-${PRODUCT_VERSION}-dSYM.zip
When I get the ipa on Xcode, everything works fine. However, I need to do it on Jenkins. What can cause this problem? Thank you.
EDIT I searched SO and found some posts (like below one). However, I need to find out which line or code this problem so I can't just directly copy and paste the answer. So please don't mark it as duplicate.
ERROR ITMS-90171: "Invalid Bundle Structure The binary file APP.app/libswiftRemoteMirror.dylib is not permitted
The problem was getting the build and then iPA from It. As I searched, the correct path was archiving the project and then get iPA from the archive with xcodebuild.
The correct two line of code is;
/usr/bin/xcodebuild -quiet -workspace ${workspaceName} -scheme ${schemeName} -sdk iphoneos -configuration Release archive -archivePath ${WORKSPACE}/build/${appName}.xcarchive
/usr/bin/xcodebuild -exportArchive -archivePath ${WORKSPACE}/build/${appName}.xcarchive -exportOptionsPlist My_Project_Main_Folder/Resources/${environment}/${environment}_ExportOptions.plist -exportPath ${WORKSPACE}/build
P.S: There is a difference between PackageApplication and Xcodebuild. Xcodebuild needs an export options plist file which tells Xcodebuild, what options does it use like Certificate, Provisioning file and Bitcode Support etc..
Example Export Options Plist File:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>destination</key>
<string>export</string>
<key>method</key>
<string>development</string>
<key>provisioningProfiles</key>
<dict>
<key>com.iamdeveloper.myapp.dev</key>
<string>My App Development Provision</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Developer</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>XXXXXXXXXX</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>

How to sign an ad-hoc iOS build without beta-reports-active entitlement?

I'm trying do an ad-hoc distribution of an app, I'm building it succesfully but getting the next error when trying to install it though iTunes:
MIS: entitlement 'beta-reports-active' has value not permitted by provisioning profile 'name_of_prov_file'
The beta-reports-active field is not set in the ad-hoc provisioning file, which is fine, but for some reason this entitlement is being added to the app in the embedded.mobileprovision file within the IPA. I think this is the problem.
I tried specifying a custom entitlements plist with:
<dict>
<key>application-identifier</key>
<string>xxxxxxxx</string>
<key>beta-reports-active</key>
<false/>
</dict>
This is showing up in the IPA in the archived-expanded-entitlements.xcent file. But the embedded.mobileprovision file still has it set to true.
I'm using these export options:
<key>method</key>
<string>ad-hoc</string>
<key>uploadSymbols</key>
<true/>
<key>teamID</key>
<string>xxxxxxxxxxxx</string>
<key>compileBitcode</key>
<false/>
And these commands:
xcodebuild -alltargets -configuration Release clean build archive -archivePath $PWD/build/archive.xcarchive -scheme projectname -sdk iphoneos9.3 "CODE_SIGN_IDENTITY=${CODE_SIGN_IDENTITY}" "CODE_SIGN_ENTITLEMENTS=entitlements.plist"
xcodebuild -exportArchive -archivePath $PWD/build/archive.xcarchive -exportPath $PWD/build/ -exportOptionsPlist exportOptions.plist
It's a Cordova application so it's not being developed with XCode and this is a Jenkins automated build.
Note: I can successfully do an app-store build for test flight, this is not what this questions is about.

Resources