【问题标题】:Fastlane finish with error "The request could not be completed because: Unauthorized Access" in iOSFastlane 在 iOS 中以错误“请求无法完成,因为:未经授权的访问”完成
【发布时间】:2019-12-18 08:23:52
【问题描述】:

我是Fastlane的新手,安装它扔官方文档。现在我想使用 Fastlane 创建一个应用程序并尝试运行基本命令“bundle exec fastlane create_app”,其中“create_app”是在我的项目中的 Fastfile 中创建的通道目录。之后,它给了我错误: "未经授权的访问"

我不明白为什么会这样?我在下面给出输出日志。

***@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

应用文件详细信息:

app_identifier "com.***.***" 
apple_id "***"

快速文件详细信息:

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

【问题讨论】:

    标签: ios continuous-integration fastlane


    【解决方案1】:

    我已经解决了 CLI 中的 2FA 问题。首先,通过以下方式删除凭据 fastlane fastlane-credentials remove --username appleID,其次,在AppleID上创建苹果应用程序密码,并将其用作fastlane "FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"中的环境变量。最后,运行lane。 添加该变量后的 Fastfile 如下所示。

    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
    

    【讨论】:

      【解决方案2】:

      我通过以下步骤解决了这个问题:

      1. 将 fastlane 更新到最新版本(在我的情况下为 2.205.1)

        运行此命令更新 fastlane:bundle update fastlane

      2. 从我的浏览器登录我的苹果帐户。

      3. https://appleid.apple.com/account/manage 创建应用专用密码并将其添加到 fastFile,如下所示:

      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
      
      1. 正在运行:fastlane ios beta 将我的应用上传到 appStore

      【讨论】:

        猜你喜欢
        • 2023-03-04
        • 2019-05-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-05-12
        • 1970-01-01
        • 2017-11-23
        相关资源
        最近更新 更多