I'm using Fastlane match and gym for building and distributing my app from a CI (Bitrise) to Fabric. My Xcode settings are set to manual with a Release configuration using the AdHoc profile as described in the Fastlane docs
Now I want to distribute to the Appstore from the CI but it fails because Xcode Release
config is set to use the AdHoc profile and Match installed the AppStore profile.
+---------------------------------------------------------------+-----------------------------------------------------------------------------+
| Summary for gym 2.112.0 |
+---------------------------------------------------------------+-----------------------------------------------------------------------------+
| scheme | AeroNavMap |
| export_method | app-store |
| export_xcargs | -allowProvisioningUpdates |
| export_options.provisioningProfiles.net.tequilaapps.airnavmap | match AppStore net.tequilaapps.airnavmap |
| workspace | ./PEMap.xcworkspace |
| destination | generic/platform=iOS |
| output_name | AeroNavMap |
| build_path | /Users/vagrant/Library/Developer/Xcode/Archives/2019-01-06 |
| clean | false |
| output_directory | . |
| silent | false |
| skip_package_ipa | false |
| result_bundle | false |
| buildlog_path | /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/fastlane_logs957341986/gym |
| skip_profile_detection | false |
| xcode_path | /Applications/Xcode.app |
+---------------------------------------------------------------+-----------------------------------------------------------------------------+
[13:47:38]: $ set -o pipefail && xcodebuild -workspace ./PEMap.xcworkspace -scheme AeroNavMap -destination 'generic/platform=iOS' -archivePath /Users/vagrant/Library/Developer/Xcode/Archives/2019-01-06/AeroNavMap\ 2019-01-06\ 13.47.38.xcarchive archive | tee /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/fastlane_logs957341986/gym/AeroNavMap-AeroNavMap.log | xcpretty
[13:47:42]: ▸ ❌ error: No profile for team 'XXXXXXXX' matching 'match AdHoc net.tequilaapps.airnavmap' found: Xcode couldn't find any provisioning profiles matching 'G9MA9G2SST/match AdHoc net.tequilaapps.airnavmap'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor. (in target 'AeroNavMap')
[13:47:42]: ▸ ** ARCHIVE FAILED *
This all makes sense but the question is how am I supposed to setup Xcode so that I can have two Fastlane lanes, one for building for AppStore, the other for AdHoc.
I could create a new Xcode config AppStore
where I'd set the AppStore provisioning profile but this rises an other issue where my custom Frameworks don't build. Similar to this question. I have many custom Frameworks and I would need to create that same AppStore
configuration in their Xcode project as well but that is too much of a hack solution.
I tried forcing gym
to use the AppStore profile as follows but that does not help. The AdHoc profile set in Xcode is still being used.
desc "Builds the app for the AppStore"
lane :build_appstore do
match(type: "appstore", readonly: true)
build_app(
scheme: "AeroNavMap",
export_method: "app-store",
skip_profile_detection: true,
export_options: { provisioningProfiles: { "net.tequilaapps.airnavmap" => "match AppStore net.tequilaapps.airnavmap"}}
)
end
My current solution is to manually update the xcodeproj just before building but this is also not very clean
lane :build_appstore do
match(type: "appstore", readonly: true)
if Helper.ci?
UI.message "Patching Xcode proj to use AppStore profile"
`sed -i.bak -e 's/match AdHoc net.tequilaapps.airnavmap/match AppStore net.tequilaapps.airnavmap/g' ../PEMap/PEMap.xcodeproj/project.pbxproj`
end
build_app(scheme: "AeroNavMap", export_method: "app-store")
end