Missing provisional profile feature when building using fastlane/Jenkins - ios

I'm trying to setup automated iOS builds using Jenking/fastlane. The codesigning was set up using fastlane match. However when Jenkins runs the job and invokes xcodebuild I'm getting:
[16:06:09]: [36m$ set -o pipefail && xcodebuild -workspace ./Runner.xcworkspace -scheme dev -configuration Release-dev -destination 'generic/platform=iOS' -archivePath /Users/Shared/Jenkins/Library/Developer/Xcode/Archives/2020-04-14/Runner\ 2020-04-14\ 16.06.09.xcarchive archive | tee /Users/Shared/Jenkins/Library/Logs/gym/Runner-dev.log | xcpretty[0m
[16:06:23]: ▸ [35m[31m❌ error: "Runner" requires a provisioning profile with the Push Notifications feature. Select a provisioning profile in the Signing & Capabilities editor. (in target 'Runner' from project 'Runner')[0m
[16:06:23]: ▸ [35m** ARCHIVE FAILED **[0m
Needless to say the profiles used does contain said feature (I've checked in Developers portal).
My Fastfile (relevant section):
private_lane :build_qa do
UI.message("Building qa build...")
sync_code_signing
sync_code_signing(type: "adhoc", readonly: true)
update_code_signing_settings(
use_automatic_signing: false,
path: "Runner.xcodeproj"
)
sh("cd ../..;
flutter build ios --release --flavor dev --no-codesign"
)
build_ios_app(
scheme: "dev",
configuration: "Release-dev",
output_name: "Runner.ipa"
)
update_code_signing_settings(
use_automatic_signing: true,
path: "Runner.xcodeproj"
)
end
Summary of match:
+-------------------------------------------------------------------------+-------------------------------------------------------------------+
| [32mSummary for gym 2.145.0[0m |
+-------------------------------------------------------------------------+-------------------------------------------------------------------+
| scheme | dev |
| configuration | Release-dev |
| output_name | Runner |
| catalyst_platform | ios |
| export_method | ad-hoc |
| export_options.provisioningProfiles.com.flutter.example.track.dev | match AdHoc com.flutter.example.track.dev |
| export_options.provisioningProfiles.com.flutter.example.track.prod | match AdHoc com.flutter.example.track.prod |
| workspace | ./Runner.xcworkspace |
| destination | generic/platform=iOS |
| build_path | /Users/Shared/Jenkins/Library/Developer/Xcode/Archives/2020-05-05 |
| clean | false |
| output_directory | . |
| silent | false |
| skip_package_ipa | false |
| result_bundle | false |
| buildlog_path | ~/Library/Logs/gym |
| skip_profile_detection | false |
| skip_package_pkg | false |
| xcode_path | /Applications/Xcode.app |
+-------------------------------------------------------------------------+-------------------------------------------------------------------+

maybe I'm a little bit late but here there is my working solution:
# Initial considerations: we want to have all the control over project settings,
# in particular
# - code signing
# - provisioning
# - team
# - app identifier
platform :ios do
lane :build do |values|
# All params should be dynamically passed with ENV vars
# Disable automatic code signing must be set BEFORE match
disable_automatic_code_signing(
path: PROJECT_PATH,
team_id: TEAM_ID
)
# match action...
# In my case app_store_connect_api_key + sync_code_signing
# Provisioning update
# NOTE: PROFILE_PATH_ENV_VAR, based on match type, is the provisioning profile path previously generated from match
# I.e. for development match type: sigh_[appBundleId]_development_profile-path
# Check https://docs.fastlane.tools/codesigning/xcode-project/#set-using-environment-variable for more info
update_project_provisioning(
xcodeproj: XCODE_PROJECT_PATH,
target_filter: TARGET_NAME,
profile: ENV["PROFILE_PATH_ENV_VAR"],
build_configuration: "Release"
)
# Project team update
update_project_team(
path: XCODE_PROJECT_PATH,
teamid: TEAM_ID
)
# App identifier update
update_app_identifier(
xcodeproj: XCODE_PROJECT_PATH,
plist_path: PLIST_PATH,
app_identifier: BUNDLE_ID
)
gym(
# ... Every custom param you need
...
codesigning_identity: CERTIFICATE_NAME,
export_options: {
compileBitcode: false,
provisioningProfiles: ENV['MATCH_PROVISIONING_PROFILE_MAPPING'], # ENV var generated from match
# http://docs.fastlane.tools/actions/sync_code_signing/#lane-variables
signingStyle: "manual"
}
)
end
end

If you use match to manage the provisioning profiles you can force them in gym/build_ios_app with export_options like these:
gym(
scheme: "dev",
configuration: "Release-dev",
output_name: "Runner.ipa"
export_options: {
compileBitcode: false,
provisioningProfiles: ENV['MATCH_PROVISIONING_PROFILE_MAPPING']
},
codesigning_identity: "Certificate name, if you want to override it as well"
)

Related

Fastlane error: Xcode couldn't find any iOS App Development provisioning profiles matching '*'

Currently, I am using the same process for building in XCode directly and in Fastlane. But while it is working perfectly in XCode (building and archiving both working fine), in Fastlane it throw an error and tells me ARCHIVE FAILED. It looks like the Fastlane is trying to find the iOS App Development provisioning profile while it only finds App Distribution profiles I assume. Is there a way to get around it, like if I can build the app with command line (without Fastlane) and use Fastlane to deploy the .ipa file I have created?
The error shown in Fastlane log:
+--------------------------------------+-----------------------------------------------------------+
| Summary for gym 2.208.0 |
+--------------------------------------+-----------------------------------------------------------+
| workspace | ./platforms/ios/myproject.xcworkspace |
| configuration | Release |
| scheme | myproject |
| output_directory | . |
| output_name | output |
| clean | true |
| export_method | app-store |
| skip_profile_detection | false |
| destination | generic/platform=iOS |
| silent | false |
| skip_package_ipa | false |
| skip_package_pkg | false |
| build_path | /Users/runner/Library/Developer/Xcode/Archives/2022-08-01 |
| result_bundle | false |
| buildlog_path | ~/Library/Logs/gym |
| xcodebuild_formatter | xcpretty |
| xcodebuild_command | xcodebuild |
| skip_package_dependencies_resolution | false |
| disable_package_automatic_updates | false |
| use_system_scm | false |
| xcode_path | /Applications/Xcode_13.2.1.app |
+--------------------------------------+-----------------------------------------------------------+
[20:25:28]: $ set -o pipefail && xcodebuild -workspace ./platforms/ios/myproject.xcworkspace -scheme myproject -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2022-08-01/output\ 2022-08-01\ 20.25.28.xcarchive clean archive | tee /Users/runner/Library/Logs/gym/myproject-myproject.log | xcpretty
[20:25:35]: ▸ Clean Succeeded
[20:25:46]: ▸ ❌ error: No profiles for 'com.myprojectapp.myproject' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.myprojecttapp.myproject'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'myproject' from project 'myproject')
[20:25:46]: ▸ ** ARCHIVE FAILED **
Code signing settings:
+-----------------------+-------------------------------------+
| Summary for code signing settings |
+-----------------------+-------------------------------------+
| use_automatic_signing | true |
| path | ./platforms/ios/myproject.xcodeproj |
+-----------------------+-------------------------------------+
Seems that you don't have automatic signing disabled and you need to either enable it or go to your Xcode project and select the right provisioning profile for what you're trying to build via Fastlane by going to Your target>Signing & Capabilities and select the proper provisioning profiles and development teams

Is it possible to use Fastlane on an iOS app with extensions?

I am working on adding a Notification Service Extension to the app I'm working on, and I am having trouble reconfiguring my Fastlane setup to work with the extension.
The problem
I don't know how to properly configure my certificates to allow for the new extension.
The error message is as follows:
error: No profile for team 'TEAMID' matching 'App Provisioning Profile' found: Xcode couldn't find any provisioning profiles matching 'TEAMID/App Provisioning Profile'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'NotificationModifier' from project 'Yeshivat Torat Shraga')
What I've tried
I tried nuking the certs
and a lot of googling, but I'm pretty lost
Relevant code and outputs
Here is the Fastlane Summary:
+------+-----------------------------------------------------+-------------+
| fastlane summary |
+------+-----------------------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+-----------------------------------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | Switch to ios load_asc_api_key lane | 0 |
| 3 | app_store_connect_api_key | 0 |
| 4 | Switch to ios prepare_signing lane | 0 |
| 5 | create_keychain | 0 |
| 6 | match | 2 |
| 7 | Switch to ios fetch_and_increment_build_number lane | 0 |
| 8 | get_version_number | 0 |
| 9 | latest_testflight_build_number | 2 |
| 10 | increment_build_number | 5 |
| 11 | Switch to ios build_release lane <== Crashing lane | 0 |
| 12 | update_code_signing_settings | 0 |
| 💥 | gym | 262 |
+------+-----------------------------------------------------+-------------+
And here is my build_release lane:
desc "Build the iOS app for release"
lane :build_release do |options|
app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
app_profile_name = "match AppStore " + app_identifier
profile_name = "App Provisioning Profile" # the name of the profile to use for the build
output_name = "YTS" # specify the name of the .ipa file to generate
export_method = "app-store" # specify the export method
compile_bitcode = true # specify whether to enable bitcode
# turn off automatic signing during build so correct code signing identity is guaranteed to be used
update_code_signing_settings(
use_automatic_signing: false,
targets: ["Yeshivat Torat Shraga", "NotificationModifier"], # specify which targets to update code signing settings for
code_sign_identity: "Apple Distribution", # replace with name of code signing identity if different
# bundle_identifier: app_identifier,
profile_name: profile_name,
build_configurations: ["Release"] # only toggle code signing settings for Release configurations
)
settings_to_override = {
:BUNDLE_IDENTIFIER => "com.appdevname.YTS",
:PROVISIONING_PROFILE_SPECIFIER => app_profile_name,
# Use BUILDCACHE override compiler paths to ensure that the correct compiler paths are used.
:CC => "clang",
:CPLUSPLUS => "clang++",
:LD => "clang",
:LDPLUSPLUS => "clang++",
}
# build the app
gym(
scheme: "Yeshivat Torat Shraga", # replace with name of your project's scheme
output_name: output_name,
configuration: "Release",
xcargs: settings_to_override,
export_options: {
method: export_method,
# provisioningProfiles: {
# app_identifier => app_profile_name
# },
compileBitcode: compile_bitcode
}
)
end
I think the root of the issue is that the certs that fastlane is using don't include the Notification Service Extension that I added, but I have no clue where to start fixing that.
I resolved this issue by removing any references to names of certificates and profiles, and let Fastlane handle the certs by itself. I am still having some issues with entitlements, and I will update this answer if I make progress on this.
Here is a link to the GitHub issue I opened regarding the remaining issue I am facing with certificates.

Circleci - always getting "There are no local code signing identities found."

I'm trying to setup a CI pipeline to build an application for iOS; specifically my goal, apart from building the app, is to also setup the automatic signing and push it to Testflight in the end. When I try to run the fastlane command to build the app locally it works as expected, however, every time I try to build it on circleci with fastlane I always get a "There are no local code signing identities found" error and then the certificates and provisioning profiles are installed from the repository, but in the end my build fails with an error: "error: There are no accounts registered with Xcode. Add your developer account to Xcode...".
I'm not sure exactly what's the issue with this and I've changed my fastfile many times to include or exclude various options that I've found while debugging this, but I'm still getting the same errors.
Here is how the pipeline looks on circleci:
/Users/distiller/project/********
[⠋] 🚀 [⠙] 🚀 [⠹] 🚀 [⠸] 🚀 [⠼] 🚀 [⠴] 🚀 [⠦] 🚀 [⠧] 🚀 [⠇] 🚀 [⠏] 🚀 [⠋] 🚀 [⠙] 🚀 [⠹] 🚀 [⠸] 🚀 [⠼] 🚀 [⠴] 🚀 [⠦] 🚀 [⠧] 🚀 [⠇] 🚀 [✔] 🚀
[09:00:06]: Sending anonymous analytics information
[09:00:06]: Learn more at https://docs.fastlane.tools/#metrics
[09:00:06]: No personal or sensitive data is sent.
[09:00:06]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: ----------------------------------------
[09:00:06]: --- Step: Verifying fastlane version ---
[09:00:06]: ----------------------------------------
[09:00:06]: Your fastlane version 2.190.0 matches the minimum requirement of 2.171.0 ✅
[09:00:06]: Driving the lane 'ios beta' 🚀
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: --------------------------------------
[09:00:06]: --- Step: Switch to ios build lane ---
[09:00:06]: --------------------------------------
[09:00:06]: Cruising over to lane 'ios build' 🚖
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: -----------------------------
[09:00:06]: --- Step: setup_circle_ci ---
[09:00:06]: -----------------------------
[09:00:06]: Creating temporary keychain: "fastlane_tmp_keychain".
[09:00:06]: $ security list-keychains -d user
[09:00:06]: ▸ "/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db"
[09:00:06]: Found keychain '/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db' in list-keychains, adding to search list skipped
[09:00:06]: Enabling match readonly mode.
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: -------------------
[09:00:06]: --- Step: is_ci ---
[09:00:06]: -------------------
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: -------------------
[09:00:06]: --- Step: match ---
[09:00:06]: -------------------
[09:00:06]: Successfully loaded '/Users/distiller/project/********/fastlane/Matchfile' 📄
+----------------+-----------------------------------------------------------------+
| Detected Values from './fastlane/Matchfile' |
+----------------+-----------------------------------------------------------------+
| git_url | git#***********************.git |
| storage_mode | git |
| type | adhoc |
| app_identifier | com.********.app |
| username | ****#************.**** |
+----------------+-----------------------------------------------------------------+
+--------------------------------+-----------------------------------------------------------------+
| Summary for match 2.190.0 |
+--------------------------------+-----------------------------------------------------------------+
| type | adhoc |
| readonly | true |
| generate_apple_certs | true |
| skip_provisioning_profiles | false |
| app_identifier | ["com.********.app"] |
| username | ****#************.*** |
| team_id | ***********|
| storage_mode | git |
| git_url | git#***********************.git |
| git_branch | master |
| shallow_clone | false |
| clone_branch_directly | false |
| keychain_name | fastlane_tmp_keychain |
| force | false |
| force_for_new_devices | false |
| skip_confirmation | false |
| skip_docs | false |
| platform | ios |
| derive_catalyst_app_identifier | false |
| fail_on_name_taken | false |
| skip_certificate_matching | false |
| skip_set_partition_list | false |
| verbose | false |
+--------------------------------+-----------------------------------------------------------------+
[09:00:06]: Cloning remote git repo...
[09:00:06]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[09:00:11]: Checking out branch master...
[09:00:11]: 🔓 Successfully decrypted certificates repo
[09:00:11]: Installing certificate...
[09:00:12]: There are no local code signing identities found.
You can run `security find-identity -v -p codesigning fastlane_tmp_keychain` to get this output.
This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774.
(Check in Keychain Access for an expired WWDR certificate: https://stackoverflow.com/a/35409835/774 has more info.)
[09:00:12]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
[09:00:12]: security: SecItemCopyMatching: The specified item could not be found in the keychain.
[09:00:12]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
+-------------------+-----------------------------------------+
| Installed Certificate |
+-------------------+-----------------------------------------+
| User ID | ********** |
| Common Name | ********************* |
| Organisation Unit | ********** |
| Organisation | ***** |
| Country | ** |
| Start Datetime | 2021-07-13 10:57:41 UTC |
| End Datetime | 2022-07-13 10:57:40 UTC |
+-------------------+-----------------------------------------+
[09:00:12]: Installing provisioning profile...
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| Installed Provisioning Profile |
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| Parameter | Environment Variable | Value |
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| App Identifier | | com.********.app |
| Type | | adhoc |
| Platform | | ios |
| Profile UUID | sigh_com.********.app_adhoc | g611aca9-****-*****-****-***** |
| Profile Name | sigh_com.********.app_adhoc_profile-name | match AdHoc com.********.app |
| Profile Path | sigh_com.********.app_adhoc_profile-path | /Users/distiller/Library/MobileDevice/Provisioning Profiles/g611aca9-****-*****-****-*****.mobileprovision |
| Development Team ID | sigh_com.********.app_adhoc_team-id | **************** |
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
[09:00:12]: All required keys, certificates and provisioning profiles are installed 🙌
[09:00:12]: Setting Provisioning Profile type to 'ad-hoc'
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:12]: ----------------------------------------------------------
[09:00:12]: --- Step: ns prepare ios --clean --release --env.stage ---
[09:00:12]: ----------------------------------------------------------
[09:00:12]: $ ns prepare ios --clean --release --env.stage
[09:01:48]: ▸
[09:01:48]: ▸ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
[09:01:48]: ▸ * *
[09:01:48]: ▸ * Using material components 5.x the N tabs component *
[09:01:48]: ▸ * will not be fonctional anymore. *
[09:01:48]: ▸ * If you need it migrate to using #nativescript-community/ui-material-tabs *
[09:01:48]: ▸ * or go back the 4.x *
[09:01:48]: ▸ * *
[09:01:48]: ▸ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
[09:01:48]: ▸ Copying template files...
[09:01:53]: ▸ Platform ios successfully added. v8.0.0
[09:01:53]: ▸ Preparing project...
...................................................................
[09:14:59]: ▸ Project successfully prepared (ios)
[09:14:59]: ▸ Configure firebase
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:15:00]: ------------------------------------------
[09:15:00]: --- Step: update_code_signing_settings ---
[09:15:00]: ------------------------------------------
+-----------------------+---------------------------------------+
| Summary for code signing settings |
+-----------------------+---------------------------------------+
| use_automatic_signing | true |
| team_id | ********** |
| path | ./platforms/ios/********.xcodeproj |
+-----------------------+---------------------------------------+
[09:15:00]: Updating the Automatic Codesigning flag to enabled for the given project '/Users/distiller/project/********/platforms/ios/********.xcodeproj/project.pbxproj'
[09:15:00]: Set Team id to: ********* for target: ******** for build configuration: Debug
[09:15:00]: Set Team id to: ********* for target: ******** for build configuration: Release
[09:15:00]: Successfully updated project settings to use Code Sign Style = 'Automatic'
[09:15:00]: Modified Targets:
[09:15:00]: * ********
[09:15:00]: Modified Build Configurations:
[09:15:00]: * Debug
[09:15:00]: * Release
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:15:00]: -----------------------
[09:15:00]: --- Step: build_app ---
[09:15:00]: -----------------------
[09:15:00]: Resolving Swift Package Manager dependencies...
[09:15:00]: $ xcodebuild -resolvePackageDependencies -workspace ./platforms/ios/********.xcworkspace -scheme ********
[09:15:06]: ▸ resolved source packages:
[09:15:06]: $ xcodebuild -showBuildSettings -workspace ./platforms/ios/********.xcworkspace -scheme ********
[09:15:09]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
[09:15:12]: Detected provisioning profile mapping: {:"com.********.app"=>"match AdHoc com.********.app"}
+----------------------------------------------------------+--------------------------------------------------------------+
| Summary for gym 2.190.0 |
+----------------------------------------------------------+--------------------------------------------------------------+
| xcargs | -allowProvisioningUpdates |
| scheme | ******** |
| workspace | ./platforms/ios/********.xcworkspace |
| export_method | ad-hoc |
| export_options.provisioningProfiles.com.********.app | match AdHoc com.********.app |
| clean | false |
| output_directory | ~/project/output/gym |
| output_name | ******** |
| silent | false |
| skip_package_ipa | false |
| skip_package_pkg | false |
| build_path | /Users/distiller/Library/Developer/Xcode/Archives/2021-08-03 |
| result_bundle | false |
| buildlog_path | ~/project/output/buildlogs/gym |
| destination | generic/platform=iOS |
| skip_profile_detection | false |
| skip_package_dependencies_resolution | false |
| disable_package_automatic_updates | false |
| use_system_scm | false |
| xcode_path | /Applications/Xcode-11.GM.Seed.2.app |
+----------------------------------------------------------+--------------------------------------------------------------+
[09:15:12]: $ set -o pipefail && xcodebuild -workspace ./platforms/ios/********.xcworkspace -scheme ******** -destination 'generic/platform=iOS' -archivePath /Users/distiller/Library/Developer/Xcode/Archives/2021-08-03/********\ 2021-08-03\ 09.15.12.xcarchive -allowProvisioningUpdates archive | tee /Users/distiller/project/output/buildlogs/gym/********-********.log | xcpretty
[09:15:18]: ▸ ❌ error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target '********' from project '********')
[09:15:18]: ▸ ❌ error: No profiles for 'com.********.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.********.app'. (in target '********' from project '********')
[09:15:18]: ▸ ** ARCHIVE FAILED **
❌ error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target '********' from project '********')
❌ error: No profiles for 'com.********.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.********.app'. (in target '********' from project '********')
** ARCHIVE FAILED **
[09:15:18]: Exit status: 65
[09:15:18]:
[09:15:18]: Maybe the error shown is caused by using the wrong version of Xcode
[09:15:18]: Found multiple versions of Xcode in '/Applications/'
[09:15:18]: Make sure you selected the right version for your project
[09:15:18]: This build process was executed using '/Applications/Xcode-11.GM.Seed.2.app'
[09:15:18]: If you want to update your Xcode path, either
[09:15:18]:
[09:15:18]: - Specify the Xcode version in your Fastfile
[09:15:18]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[09:15:18]:
[09:15:18]: - Specify an absolute path to your Xcode installation in your Fastfile
[09:15:18]: ▸ xcode_select "/Applications/Xcode8.app"
[09:15:18]:
[09:15:18]: - Manually update the path using
[09:15:18]: ▸ sudo xcode-select -s /Applications/Xcode.app
[09:15:18]:
+---------------+--------------------------------------+
| Build environment |
+---------------+--------------------------------------+
| xcode_path | /Applications/Xcode-11.GM.Seed.2.app |
| gym_version | 2.190.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS13.0.sdk |
+---------------+--------------------------------------+
[09:15:18]: ▸ note: Using new build system
[09:15:18]: ▸ note: Planning build
[09:15:18]: ▸ note: Constructing build description
[09:15:18]: ▸ error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target '********' from project '********')
[09:15:18]: ▸ error: No profiles for 'com.********.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.********.app'. (in target '********' from project '********')
[09:15:18]:
[09:15:18]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[09:15:18]: 📋 For the complete and more detailed error log, check the full log at:
[09:15:18]: 📋 /Users/distiller/project/output/buildlogs/gym/********-********.log
[09:15:18]:
[09:15:18]: Looks like fastlane ran into a build/archive error with your project
[09:15:18]: It's hard to tell what's causing the error, so we wrote some guides on how
[09:15:18]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[09:15:18]: Before submitting an issue on GitHub, please follow the guide above and make
[09:15:18]: sure your project is set up correctly.
[09:15:18]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[09:15:18]: the full commands printed out in yellow in the above log.
[09:15:18]: Make sure to inspect the output above, as usually you'll find more error information there
[09:15:18]:
+------------------------------------+--------------------------------------------------------------+
| Lane Context |
+------------------------------------+--------------------------------------------------------------+
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/fastlane_tmp_keychain |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/distiller/Library/Keychains/login.keychain-db" |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.********.app"=>"match AdHoc com.********.app"} |
+------------------------------------+--------------------------------------------------------------+
[09:15:18]: Error building the application - see the log above
+------+----------------------------------------------+-------------+
| fastlane summary |
+------+----------------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+----------------------------------------------+-------------+
| 1 | Verifying fastlane version | 0 |
| 2 | Switch to ios build lane | 0 |
| 3 | setup_circle_ci | 0 |
| 4 | is_ci | 0 |
| 5 | match | 5 |
| 6 | ns prepare ios --clean --release --env.stage | 887 |
| 7 | update_code_signing_settings | 0 |
| 💥 | build_app | 18 |
+------+----------------------------------------------+-------------+
[09:15:18]: fastlane finished with errors
[!] Error building the application - see the log above
failed or skipped
cat: /Users/distiller/Library/Logs/gym/********-********.log: No such file or directory
log not found
Some things that I've tried on the fastfile is to:
create a temporary keychain and unlock it by using create_keychain(...) and unlock_keychain()
include keychain_name and keychain_password on match(...)
use setup_circle_ci which is an option for circleci to create a temporary keychain for you.
Lastly, this is what my fastfile looks like:
fastlane_version '2.171.0'
platform :ios do
before_all do
setup_circle_ci
end
desc 'Fetch certificates and provisioning profiles'
lane :certificates do
match(type: 'development')
match(type: "appstore")
end
desc 'Build the iOS application.'
lane :build do
# setup_circle_ci
# sh("security", "list-keychains", "-d", "user")
# create_keychain(
# name: "login.keychain",
# password: "test",
# default_keychain: true,
# unlock: true,
# timeout: 3600,
# lock_when_sleeps: false,
# add_to_search_list: true
# )
# unlock_keychain(
# path: "/Users/distiller/Library/Keychains/login.keychain",
# add_to_search_list: :replace,
# password: "test",
# )
# sh("security", "find-identity", "-v", "-p", "codesigning", "login.keychain")
match(
type: "appstore",
readonly: is_ci,
keychain_name: "fastlane_tmp_keychain",
keychain_password: "",
verbose: true
)
# sh("security", "find-identity", "-v", "-p", "codesigning", "login.keychain")
sh("ns", "prepare", "ios", "--clean", "--release", "--env.stage")
update_code_signing_settings(
use_automatic_signing: true,
team_id: "*****",
path: "./platforms/ios/*******.xcodeproj"
)
# update_project_provisioning(
# xcodeproj: "./platforms/ios/*******.xcodeproj",
# profile: ENV["sigh_com.*******.app_adhoc_profile-path"]
# # build_configuration: "Release"
# )
build_app(
xcargs: "-allowProvisioningUpdates",
scheme: "*******",
workspace: './platforms/ios/*******.xcworkspace',
export_method: "app-store"
# export_options: {
# provisioningProfiles: {
# "com.*******.app" => "match Appstore com.********.app"
# }
# }
)
end
desc 'Ship to Testflight.'
lane :beta do
build
changelog_from_git_commits
upload_to_testflight(
beta_app_feedback_email: "****#*******.****",
beta_app_description: "Test deployment",
demo_account_required: false,
distribute_external: false,
groups: [],
notify_external_testers: false,
skip_submission: true
)
end
end
If anyone can help me with this you'll be saving me! Thanks!

how to reuse the apple certificate with fastlane match

Because the personal developer only could have 3 distribution certificate(https://help.apple.com/xcode/mac/current/#/dev3a05256b8), I have more than 3 apps, so I have to make different app use the same certificate, this is what I am trying to do.
Step 1: export the certificate from keychain
step 2: generate the cert file and pem file by using this command:
openssl pkcs12 -nocerts -nodes -out key.pem -in Certificates.p12
openssl aes-256-cbc -k 225843 -in key.pem -out MLD9L5TNVK.p12 -a
openssl aes-256-cbc -k 225843 -in Certificates.cer -out MLD9L5TNVK.cer -a
then add the MLD9L5TNVK.p12 and MLD9L5TNVK.cer file to the certificate repo that management by fastlane match.
step 3: using fastlane match to generate the provision file:
fastlane match adhoc
but when I using this command to publish the ios package in GitHub Actions:
- name: Deploy to TestFlight/PGY
run: |
cd ./ios
bundle exec fastlane beta
env:
FLUTTER_ROOT: ${{ secrets.FLUTTER_ROOT }}
APPLE_ID: ${{ secrets.APPLE_ID }}
GIT_URL: ${{ secrets.GIT_URL }}
PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
show this error message:
No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
this is the detail log output:
+-----------------------------------------------------------+-----------------------------------------------------------+
| Summary for gym 2.191.0 |
+-----------------------------------------------------------+-----------------------------------------------------------+
| workspace | Runner.xcworkspace |
| scheme | Runner |
| export_method | ad-hoc |
| export_options.provisioningProfiles.com.reddwarf.musicapp | match AdHoc com.reddwarf.musicapp 1629273389 |
| clean | false |
| output_directory | . |
| output_name | Runner |
| silent | false |
| skip_package_ipa | false |
| skip_package_pkg | false |
| build_path | /Users/runner/Library/Developer/Xcode/Archives/2021-08-18 |
| result_bundle | false |
| buildlog_path | ~/Library/Logs/gym |
| destination | generic/platform=iOS |
| skip_profile_detection | false |
| skip_package_dependencies_resolution | false |
| disable_package_automatic_updates | false |
| use_system_scm | false |
| xcode_path | /Applications/Xcode_12.4.app |
+-----------------------------------------------------------+-----------------------------------------------------------+
[10:05:55]: $ set -o pipefail && xcodebuild -workspace Runner.xcworkspace -scheme Runner -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2021-08-18/Runner\ 2021-08-18\ 10.05.55.xcarchive archive | tee /Users/runner/Library/Logs/gym/Runner-Runner.log | xcpretty
[10:06:00]: ▸ ❌ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
[10:06:00]: ▸ The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
[10:06:00]: ▸ ** ARCHIVE FAILED **
❌ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
** ARCHIVE FAILED **
[10:06:00]: Exit status: 65
[10:06:00]:
[10:06:00]: Maybe the error shown is caused by using the wrong version of Xcode
[10:06:00]: Found multiple versions of Xcode in '/Applications/'
[10:06:00]: Make sure you selected the right version for your project
[10:06:00]: This build process was executed using '/Applications/Xcode_12.4.app'
[10:06:00]: If you want to update your Xcode path, either
[10:06:00]:
[10:06:00]: - Specify the Xcode version in your Fastfile
[10:06:00]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[10:06:00]:
[10:06:00]: - Specify an absolute path to your Xcode installation in your Fastfile
[10:06:00]: ▸ xcode_select "/Applications/Xcode8.app"
[10:06:00]:
[10:06:00]: - Manually update the path using
[10:06:00]: ▸ sudo xcode-select -s /Applications/Xcode.app
[10:06:00]:
+---------------+------------------------------+
| Build environment |
+---------------+------------------------------+
| xcode_path | /Applications/Xcode_12.4.app |
| gym_version | 2.191.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS14.4.sdk |
+---------------+------------------------------+
[10:06:00]: ▸ note: Building targets in parallel
[10:06:00]: ▸ note: Planning build
[10:06:00]: ▸ note: Constructing build description
[10:06:00]: ▸ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
[10:06:00]: ▸ warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
[10:06:00]:
[10:06:00]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[10:06:00]: 📋 For the complete and more detailed error log, check the full log at:
[10:06:00]: 📋 /Users/runner/Library/Logs/gym/Runner-Runner.log
[10:06:00]:
[10:06:00]: Looks like fastlane ran into a build/archive error with your project
[10:06:00]: It's hard to tell what's causing the error, so we wrote some guides on how
[10:06:00]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[10:06:00]: Before submitting an issue on GitHub, please follow the guide above and make
[10:06:00]: sure your project is set up correctly.
[10:06:00]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[10:06:00]: the full commands printed out in yellow in the above log.
[10:06:00]: Make sure to inspect the output above, as usually you'll find more error information there
[10:06:00]:
+------------------------------------+---------------------------------------------------------------------------+
| Lane Context |
+------------------------------------+---------------------------------------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/*** |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/***.keychain-db" |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.reddwarf.musicapp"=>"match AdHoc com.reddwarf.musicapp 1629273389"} |
+------------------------------------+---------------------------------------------------------------------------+
[10:06:00]: Error building the application - see the log above
+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
| 2 | xcode_select | 0 |
| 3 | create_keychain | 0 |
| 4 | is_ci | 0 |
| 5 | match | 2 |
| 💥 | build_app | 8 |
+------+------------------+-------------+
[10:06:00]: fastlane finished with errors
[!] Error building the application - see the log above
Error: Process completed with exit code 1.
why would this happen? what should I do to fix this problem?Any help is appreciated. I can not revoke the certificate because the certificate is using now. I also tried to find the iOS Distribution but failed:
did not found the "iOS distribution".
If you want to use a single developer and/or distribution certificate for multiple apps belonging to the same development team, you may use the same signing identities repository and branch to store the signing identities for your apps:
Matchfile example for both App #1 and #2:
git_url("https://github.com/example/example-repo.git")
git_branch("master")
match will reuse certificates and will create separate provisioning profiles for each app.

Fastlane match build adhoc and appstore

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
There are two code signing phases when you archive a build (using Xcode or gym): the code signing identity used when building (in Xcode that's what set in the build settings of your target) and the one used when exporting the archive (the one you select in the export dialog from the organizer when exporting the archive via Xcode manually)
What we do in our Fastfiles is set both to the same value when invoking gym. We override the build settings using xcargs and use there the same signing as the one we set in export_options:
MY_APP_ID = "com.foo.bar"
MY_PROFILE = "match AppStore com.foo.bar"
MY_TEAM = …
match(
app_identifier: MY_APP_ID,
type: "appstore",
readonly: true
)
settings_to_override = {
:BUNDLE_IDENTIFIER => MY_APP_ID,
:PROVISIONING_PROFILE_SPECIFIER => MY_PROFILE,
:DEVELOPMENT_TEAM => MY_TEAM
}
gym(
workspace: WORKSPACE_PATH,
scheme: "Foo",
configuration: "Production",
xcargs: settings_to_override,
export_method: "app-store",
export_options: {
provisioningProfiles: {
MY_APP_ID => MY_PROFILE
}
}
)
Credit to https://github.com/AliSoftware

Resources