While sending my application to the testflight via fastlane, I faced with this error:
Unauthorized Access
**FastLanelane summary**
| 1 | opt_out_usage | 0 |
| 2 | default_platform | 0 |
| 3 | update_fastlane | 0 |
| 4 | clear_derived_data | 0 |
| 5 | cocoapods | 3 |
| 6 | gym | 87 |
| 💥 | pilot | 3 |
ERROR [2019-03-01 15:51:34.03]: fastlane finished with errors
Looking for related GitHub issues on fastlane/fastlane... Search
query: The request could not be completed because: Unauthorized
Access
Here is my Fasfile:
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
update_fastlane
clear_derived_data
cocoapods(clean: true, use_bundle_exec: false)
# Build
gym(clean: true, suppress_xcode_output: true, workspace: "com.xxxx.xcworkspace", scheme: "com.xxxx")
# Submit to iTunes Connect (upload_to_testflight)
pilot(skip_submission: true, skip_waiting_for_build_processing: true)
upload_symbols_to_crashlytics # Upload dSYM symbolication files to Crashlytics
end
end
Common Case
be sure that your role permission should be at least the App Manager!
In My Case
I noticed that I entered the two-factor Authentication (6-digit code) code incorrectly.
Remember that, starting on February 27, 2019 Apple requiring all developers to have two-factor authentication enabled for their Apple IDs, with two-factor necessary for signing into Developer accounts after that date. Means it's necessary for our fastlane flows too.
Related
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
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.
I am maintaining an app that is deployed to the app store. We are using Fastlane and our certificate and provisional profile has expired.
I'm trying to use fastlane match to generate a new certificate. I have deleted the expired certificates in the Git repo that Fastlane points to.
Running fastlane match, I get the following error:
[16:50:09]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[16:50:10]: Checking out branch master...
[16:50:10]: [32m🔓 Successfully decrypted certificates repo[0m
[16:50:10]: Verifying that the certificate and profile are still valid on the Dev Portal...
[16:50:10]: Creating authorization token for App Store Connect API
[16:50:11]: [33mCouldn't find a valid code signing identity for distribution... creating one for you now[0m
+-------------------------+-----------------------------------------------------------------------------------------------------------------+
| [32mSummary for cert 2.177.0[0m |
+-------------------------+-----------------------------------------------------------------------------------------------------------------+
| platform | ios |
| development | false |
| generate_apple_certs | true |
| force | true |
| api_key_path | **** |
| username | redacted |
| team_id | redacted
| keychain_path | /Users/jenkins/Library/Keychains/login.keychain-db |
| keychain_password | ******** |
| skip_set_partition_list | false |
+-------------------------+-----------------------------------------------------------------------------------------------------------------+
[16:50:11]: Creating authorization token for App Store Connect API
+---------------+------+
| [33mLane Context[0m |
+---------------+------+
| PLATFORM_NAME | |
| LANE_NAME | beta |
+---------------+------+
[16:50:11]: [31mCannot determine if team is App Store or Enterprise via the App Store Connect API (yet). Set 'in_house' on your Spaceship::ConnectAPI::Token. Or set 'in_house' in your App Store Connect API key JSON file. Or set the 'SPACESHIP_CONNECT_API_IN_HOUSE' environment variable to 'true'. View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/[0m
Wondering if anyone has seen this before and has any idea what it means?
Thanks
PS - first time posting so appreciate any tips
UPDATE
I have managed to resolve this issue. Our build goes through Jenkins so I had to add in_house:false to our App Store Connect API key JSON file.
UPDATE
I have managed to resolve this issue. Our build goes through Jenkins so I had to add in_house:false to our App Store Connect API key JSON file.
Simply I have 2 lanes in AppFile:
for_lane :app_dev do
apple_id "email#email1.com"
team_id "KLMNOPGRST"
end
for_lane :app_prod do
apple_id "email#email2.com"
team_id "ABCDEFGHIJ"
end
And for team_id ABCDEFGHIJ there is certificate BCERT and for team_id KLMNOPGRST there is ACERT certificate. Both of them are installed on CI machine... but for the first lane app_test CI founds certificate BCERT instead of ACERT. Why?
+-------------------------+---------------------------------------------------+
| Summary for cert 2.180.1 |
+-------------------------+---------------------------------------------------+
| api_key | ******** |
| development | false |
| force | false |
| generate_apple_certs | true |
| username | email#email1.com |
| team_id | KLMNOPGRST |
| keychain_path | /Users/me/Library/Keychains/login.keychain-db |
| skip_set_partition_list | false |
| platform | ios |
+-------------------------+---------------------------------------------------+
[11:29:00]: Creating authorization token for App Store Connect API
[11:29:01]: Found the certificate 56JF6H2Y6G (BCERT) which is installed on the local machine. Using this one.
[11:29:01]: Verifying the certificate is properly installed locally...
[11:29:01]: Successfully installed certificate 56JF6H2Y6G
[11:29:01]: Use signing certificate '56JF6H2Y6G' from now on!
[11:29:01]: ------------------
[11:29:01]: --- Step: sigh ---
[11:29:01]: ------------------
I'm new in Fastlane and install it throw the official document. Now I want to create an app using Fastlane and try to run the basic command "bundle exec fastlane create_app" where "create_app" is a lane created in my Fastfile in my project directory. After that, it is giving me the error:
"Unauthorized Access"
I didn't understand why this is happening? I'm giving the output log below.
***#iOS-MAC-15 TryFastlane % bundle exec fastlane create_app
[✔] 🚀
[10:27:24]: ------------------------------
[10:27:24]: --- Step: default_platform ---
[10:27:24]: ------------------------------
[10:27:24]: Driving the lane 'ios create_app' 🚀
[10:27:24]: ---------------------
[10:27:24]: --- Step: produce ---
[10:27:24]: ---------------------
+----------------+--------------------------------+
| Summary for produce 2.137.0 |
+----------------+--------------------------------+
| username | *** |
| app_identifier | com.***.*** |
| sku | 1576643244 |
| platform | ios |
| language | English |
| skip_itc | false |
| skip_devcenter | false |
+----------------+--------------------------------+
Two-factor Authentication (6 digits code) is enabled for account '***'
More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915
If you're running this in a non-interactive session (e.g. server or CI)
check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification
Environment variable `SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER` is set, automatically requesting 2FA token via SMS to that number
SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER = ***
Successfully requested text message to ***
Please enter the 6 digit code you received at ***:
999822
Requesting session...
+------------------+----------------+
| Lane Context |
+------------------+----------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios create_app |
+------------------+----------------+
[10:37:21]: Unauthorized Access
+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
| 💥 | produce | 597 |
+------+------------------+-------------+
[10:37:21]: fastlane finished with errors
Looking for related GitHub issues on fastlane/fastlane...
➡️ The request could not be completed because: Unauthorized Access
https://github.com/fastlane/fastlane/issues/15411 [closed] 21 💬
3 weeks ago
➡️ Unauthorized Access when I use Fastlane pilot upload
https://github.com/fastlane/fastlane/issues/15125 [closed] 6 💬
5 weeks ago
➡️ The request could not be completed because:Unauthorized Access
https://github.com/fastlane/fastlane/issues/13923 [closed] 14 💬
31 Jul 2019
and 15 more at: https://github.com/fastlane/fastlane/search?q=The%20request%20could%20not%20be%20completed%20because%3A%0A%09Unauthorized%20Access&type=Issues&utf8=✓
🔗 You can ⌘ + double-click on links to open them directly in your browser.
[!] The request could not be completed because:
Unauthorized Access
Appfile Details:
app_identifier "com.***.***"
apple_id "***"
Fastfile Details:
default_platform(:ios)
platform :ios do
before_all do
ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"] = "***"
ENV["FASTLANE_USER"] = "***"
ENV["FASTLANE_PASSWORD"] = "***"
end
# 1
desc "Create app on Apple Developer and App Store Connect sites"
# 2
lane :create_app do
# 3
produce
end
end
I have solved the issue it is 2FA in CLI. First, remove the credential by
fastlane fastlane-credentials remove --username appleID, Second, create apple application password on AppleID and use it as environment variable in fastlane "FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD" .finally, run the lane.
The Fastfile after added that variable looks like this.
default_platform(:ios)
platform :ios do
before_all do
ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"] = "***"
ENV["FASTLANE_USER"] = "***"
ENV["FASTLANE_PASSWORD"] = "***"
ENV["FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"] = "***"
end
# 1
desc "Create app on Apple Developer and App Store Connect sites"
# 2
lane :create_app do
# 3
produce
end
end
I solved the issue by following steps:
Updating the fastlane to latest version (2.205.1 in my case)
run this command to update fastlane : bundle update fastlane
signing in to my apple account from my browser.
Creating app specific password from https://appleid.apple.com/account/manage and adding it to fastFile like this:
default_platform(:ios)
platform :ios do
ENV["FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"] = "YOUR-APP-SPECIFIC_PASS"
desc "Push a new beta build to TestFlight"
lane :beta do
increment_build_number(xcodeproj: "Runner.xcodeproj")
build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
upload_to_testflight(skip_waiting_for_build_processing: true)
end
end
running : fastlane ios beta to upload my app to appStore