增量捆绑版本错误 - Fastfile

问题描述 投票:0回答:1

我有以下 Fastfile,用于上传 MacOS 应用程序的 TestFlight 版本:

# Fastfile
default_platform(:mac)

DEVELOPER_APP_ID = ENV["DEVELOPER_APP_ID"]
APP_IDENTIFIER = ENV["APP_IDENTIFIER"]
PROVISIONING_PROFILE_SPECIFIER = ""
TEMP_KEYCHAIN_USER = ENV["TEMP_KEYCHAIN_USER"]
TEMP_KEYCHAIN_PASSWORD = ENV["TEMP_KEYCHAIN_PASSWORD"]
APPLE_ISSUER_ID = ENV["APPLE_ISSUER_ID"]
APPLE_KEY_ID = ENV["APPLE_KEY_ID"]
APPLE_KEY_CONTENT = ENV["APPLE_KEY_CONTENT"]
GIT_AUTHORIZATION = ENV["GIT_AUTHORIZATION"]
TEAM_ID = '752MACT599'
ORG_NAME = 'Meter'
PROJECT_NAME = 'Meter'
SIGH_PROVISIONING_PROFILE_NAME = "com.meter.vpn-client1 AppStore"

def delete_temp_keychain(name)
  delete_keychain(
    name: name
  ) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db")
end

def create_temp_keychain(name, password)
  create_keychain(
    name: name,
    password: password,
    unlock: false,
    timeout: 0
  )
end

def ensure_temp_keychain(name, password)
  delete_temp_keychain(name)
  create_temp_keychain(name, password)
end

update_fastlane

desc 'Build, Archive, and Upload to App Store Connect'
lane :release do |options|
  is_nightly = 0

  app_identifier = ENV['APP_IDENTIFIER']
  scheme = 'Meter'
  configuration = 'Release'

  UI.message("Debug: Creating App Store Connect API key...")

  keychain_name = TEMP_KEYCHAIN_USER
  keychain_password = TEMP_KEYCHAIN_PASSWORD
  ensure_temp_keychain(keychain_name, keychain_password)

  api_key = app_store_connect_api_key(
    key_id: APPLE_KEY_ID,
    issuer_id: APPLE_ISSUER_ID,
    key_content: APPLE_KEY_CONTENT,
    duration: 1200,
    in_house: false
  )

  increment_build_number(
    xcodeproj: "Meter.xcodeproj"
  )
  
  match(
    # app_identifier: app_identifier,
    git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
    additional_cert_types: 'mac_installer_distribution',
    readonly: false,
    keychain_name: keychain_name,
    keychain_password: keychain_password,
    api_key: api_key,
    platform: "macos"
  )
  cert(
    keychain_path: "~/Library/Keychains/#{keychain_name}-db",
    keychain_password: keychain_password,
    api_key: api_key,
    platform: "macos"
  )
  sigh(
    app_identifier: app_identifier,
    readonly: false,
    cert_id: lane_context[SharedValues::CERT_CERTIFICATE_ID],
    provisioning_name: ENV['SIGH_PROVISIONING_PROFILE_NAME'],
    ignore_profiles_with_different_name: true,
    api_key: api_key,
    platform: "macos"
  )

  update_project_team(
    path: "Meter.xcodeproj",
    teamid: TEAM_ID
  )

  gym(
    project: 'Meter.xcodeproj',
    scheme: scheme,
    export_method: 'app-store',
    configuration: configuration,
    clean: false,
    derived_data_path: './build',
    xcargs: "WARNING_CFLAGS='$(inherited)'",
    skip_profile_detection: true,
  )

  upload_to_testflight(
    app_identifier: app_identifier,
    skip_submission: true,
    skip_waiting_for_build_processing: true,
    pkg: './Meter.pkg'
  )
end

我不断收到以下错误;即使我增加了捆绑包 ID:

[19:42:32]: Successfully exported and signed the pkg file:
[19:42:32]: /Users/runner/work/client-app-swift/client-app-swift/Meter.pkg
[19:42:32]: ----------------------------------
[19:42:32]: --- Step: upload_to_testflight ---
[19:42:32]: ----------------------------------
[19:42:32]: Creating authorization token for App Store Connect API
[19:42:33]: Ready to upload new build to TestFlight (App: 6449044498)...
[19:42:33]: Going to upload updated app to App Store Connect
[19:42:33]: This might take a few minutes. Please don't interrupt the script.
[19:42:39]: [altool] 2023-09-27 19:42:39.760 *** Error: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: '27'. (ID: a4eed95a-923c-40d7-a697-0c47012fe8be) (-19232)

[19:42:39]: [altool]  {

[19:42:39]: [altool]     NSLocalizedDescription = "The provided entity includes an attribute with a value that has already been used";

[19:42:39]: [altool]     NSLocalizedFailureReason = "The bundle version must be higher than the previously uploaded version: \U201827\U2019. (ID: a4eed95a-923c-40d7-a697-0c47012fe8be)";

[19:42:39]: [altool]     NSUnderlyingError = "Error Domain=IrisAPI Code=-19241 \"The provided entity includes an attribute with a value that has already been used\" UserInfo={status=409, detail=The bundle version must be higher than the previously uploaded version., source={\n    pointer = \"/data/attributes/cfBundleVersion\";\n}, id=a4eed95a-923c-40d7-a697-0c47012fe8be, code=ENTITY_ERROR.ATTRIBUTE.INVALID.DUPLICATE, title=The provided entity includes an attribute with a value that has already been used, meta={\n    previousBundleVersion = 27;\n}, NSLocalizedDescription=The provided entity includes an attribute with a value that has already been used, NSLocalizedFailureReason=The bundle version must be higher than the previously uploaded version.}";

[19:42:39]: [altool]     "iris-code" = "ENTITY_ERROR.ATTRIBUTE.INVALID.DUPLICATE";

[19:42:39]: [altool]     previousBundleVersion = 27;

[19:42:39]: [altool] }

[19:42:39]: Application Loader output above ^
[19:42:39]: Error uploading '/var/folders/r_/vbvvglrx3lvds6dp_mbyq3_c0000gn/T/881530bf-4d94-4419-84f8-32cb1b667364.pkg'.

[19:42:39]: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: '27'. (ID: a4eed95a-923c-40d7-a697-0c47012fe8be) (-19232)

[19:42:39]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.
[19:42:39]: Could not download/upload from App Store Connect!
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                              Lane Context                                                                                               |
+------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DEFAULT_PLATFORM                   | mac                                                                                                                                                                |
| PLATFORM_NAME                      |                                                                                                                                                                    |
| LANE_NAME                          | release                                                                                                                                                            |
| KEYCHAIN_PATH                      | ~/Library/Keychains/***                                                                                                                                        |
| BUILD_NUMBER                       | 2                                                                                                                                                                  |
| SIGH_PROFILE_TYPE                  | app-store                                                                                                                                                          |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"***"=>"match AppStore *** macos", "***.extension"=>"match AppStore ***.extension macos"} |
| CERT_FILE_PATH                     | /Users/runner/work/client-app-swift/client-app-swift/7532RULTT7.cer                                                                                                |
| CERT_CERTIFICATE_ID                | 7532RULTT7                                                                                                                                                         |
| SIGH_PROFILE_PATH                  | /Users/runner/work/client-app-swift/client-app-swift/AppStore_***.provisionprofile                                                               |
| SIGH_PROFILE_PATHS                 | ["/Users/runner/work/client-app-swift/client-app-swift/AppStore_***.provisionprofile"]                                                           |
| SIGH_UDID                          | 61cc4105-d494-4957-a18a-1a757e194d34                                                                                                                               |
| SIGH_UUID                          | 61cc4105-d494-4957-a18a-1a757e194d34                                                                                                                               |
| SIGH_NAME                          | match AppStore *** macos                                                                                                                         |
| PKG_OUTPUT_PATH                    | /Users/runner/work/client-app-swift/client-app-swift/Meter.pkg                                                                                                     |
| XCODEBUILD_ARCHIVE                 | /Users/runner/Library/Developer/Xcode/Archives/2023-09-27/Meter 2023-09-27 19.39.33.xcarchive                                                                      |
+------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[19:42:39]: Error uploading pkg file: 
 [Application Loader Error Output]: Error uploading '/var/folders/r_/vbvvglrx3lvds6dp_mbyq3_c0000gn/T/881530bf-4d94-4419-84f8-32cb1b667364.pkg'.
[Application Loader Error Output]: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: '27'. (ID: a4eed95a-923c-40d7-a697-0c47012fe8be) (-19232)
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.

+------------------------------------------------+
|                fastlane summary                |

[!] Error uploading pkg file: 
 [Application Loader Error Output]: Error uploading '/var/folders/r_/vbvvglrx3lvds6dp_mbyq3_c0000gn/T/881530bf-4d94-4419-84f8-32cb1b667364.pkg'.
[Application Loader Error Output]: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: '27'. (ID: a4eed95a-923c-40d7-a697-0c47012fe8be) (-19232)
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.
+------+---------------------------+-------------+
| Step | Action                    | Time (in s) |
+------+---------------------------+-------------+
| 1    | default_platform          | 0           |
| 2    | update_fastlane           | 5           |
| 3    | create_keychain           | 0           |
| 4    | app_store_connect_api_key | 0           |
| 5    | increment_build_number    | 6           |
| 6    | match                     | 4           |
| 7    | cert                      | 0           |
| 8    | sigh                      | 0           |
| 9    | update_project_team       | 0           |
| 10   | gym                       | 299         |
| 💥   | upload_to_testflight      | 6           |
+------+---------------------------+-------------+

[19:42:39]: fastlane finished with errors
macos github-actions fastlane fastlane-gym
1个回答
0
投票

我明白了:

[19:42:39]: [altool] 2023-09-27 19:42:39.760 *** 
Error: The provided entity includes an attribute with a value that has already been used
The bundle version must be higher than the previously uploaded version: '27'. 
(ID: a4eed95a-923c-40d7-a697-0c47012fe8be) (-19232)

意味着,您尝试上传到 TestFlight 的新版本具有 App Store Connect 中已存在的 bundle 版本号。
如果您尝试上传的新构建版本与之前上传的构建版本相同或更低,通常会发生这种情况。

您的 Fastfile 包括

increment_build_number
操作:

increment_build_number(
  xcodeproj: "Meter.xcodeproj"
)

此操作应该会增加 Xcode 项目中的内部版本号,但错误表明情况并非如此。

因此请确保您增加了正确的属性; iOS 和 macOS 应用程序都有

CFBundleVersion
(内部版本号)和
CFBundleShortVersionString
(版本号),如本评论中所述。如果您只增加其中一项而不增加另一项,您仍然可能会遇到此错误。

您可以将

--verbose

 添加到 
fastlane
 命令中以获取更多详细信息,这可以让您了解为什么内部版本号没有按预期增加。

fastlane release --verbose
您还可以在 

increment_build_number

 操作之前和之后添加调试语句以打印当前版本号。这可以帮助您了解它是否在增加。

before_build_number = get_build_number( xcodeproj: "Meter.xcodeproj" ) UI.message("Build number before increment: #{before_build_number}") increment_build_number( xcodeproj: "Meter.xcodeproj" ) after_build_number = get_build_number( xcodeproj: "Meter.xcodeproj" ) UI.message("Build number after increment: #{after_build_number}")
    
© www.soinside.com 2019 - 2024. All rights reserved.