I'm trying to upload bundle to Appstore with Github Actions for an app with multiple targets (one per environment: internal, client and retail). I'm getting this error:
*** Error: Error uploading 'build/Products/IPA/myapp.ipa'. *** Error: Could not determine the package’s bundle ID. The package is missing an Info.plist or the CFBundlePackageType is not ‘APPL’ or ‘FMWK’. Unable to validate your application. (-21017) { NSLocalizedDescription = "Could not determine the package\U2019s bundle ID. The package is missing an Info.plist or the CFBundlePackageType is not \U2018APPL\U2019 or \U2018FMWK\U2019."; NSLocalizedFailureReason = "Unable to validate your application."; }
I already have CFBundlePackageType with APPL. I also tried changing it to FMWK. This is the content of my Info.plist inside the folder's corresponding target:
<!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>$(PRODUCT_NAME)</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>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.myapp.internal</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.myapp.internal</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>$(PRODUCT_NAME) would like to use Apple Music</string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) would like to use your camera for modifying your avatar picture.</string>
<key>NSFaceIDUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to use FaceID</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to use location</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) would like to use location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to use location</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) would like to use your microphone</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) would like access to your photo gallery for uploading your avatar picture.</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>location</string>
</array>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
And I'm using these commands to generate the bundle:
cd ios
BUILD_NUMBER=$(date +%Y%m%d%H%M)
xcrun agvtool new-version -all ${BUILD_NUMBER}
# creates an .xarchive file
xcodebuild -workspace myapp.xcworkspace \
-scheme myappinternal clean archive -configuration Internal \
-archivePath ./build/Products/myapp.xcarchive \
# converts the .xarchive file to .ipa by including the provisioning profile
xcodebuild -exportArchive \
-archivePath ./build/Products/myapp.xcarchive \
-exportPath ./build/Products/IPA/myapp.ipa \
-exportOptionsPlist exportOptionsInternal.plist
# upload the .ipa to Apple Connect
xcrun altool --upload-app --type ios --file ./build/Products/IPA/myapp.ipa \
--username "$IOS_APP_STORE_CONNECT_USERNAME" --password "$IOS_APP_STORE_CONNECT_PASSWORD"
The content of the exportOptionsInternal.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>method</key>
<string>app-store</string>
<key>provisioningProfiles</key>
<dict>
<key>com.myapp.internal</key>
<string>Github_Actions_Myapp_Internal</string>
</dict>
</dict>
</plist>
I appreciate any help. I've been struggling with this for a while. I'm new to all of this and honestly don't know what to do.
I had the same problem when my MacBook updated to XCode 14. Circle CI worked well (XCode 13.4.1 + Fastlane) with the same code.
Finally, it worked again after I removed the workaround ITMSTRANSPORTER_FORCE_ITMS_PACKAGE_UPLOAD=true
See more: https://github.com/fastlane/fastlane/issues/20741#issuecomment-1306967243
Original poster did not mention fastlane, and all the answers are related to fastlane. So for anyone who is experiencing this problem, while not using fastlane (using command line interface), the problem in the original question is with the second command:
xcodebuild -exportArchive \
-archivePath ./build/Products/myapp.xcarchive \
-exportPath ./build/Products/IPA/myapp.ipa \ <--- THIS IS THE PROBLEM
-exportOptionsPlist exportOptionsInternal.plist
The export path should not include the name of the IPA file. The name of the ipa file will be automatically generated from the $(PRODUCT_NAME). So if you specify ./build/Products/IPA/myapp.ipa, the IPA will actually be something like ./build/Products/IPA/myapp.ipa/My App.ipa
Instead, provide the -exportPath ./build/Products/IPA.
And in xcrun altool ensure that you are referring to a correct name of the IPA. It may not be ./build/Products/IPA/myapp.ipa as you expect, but ./build/Products/IPA/My App.ipa.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With