我一直在尝试使用 fastlane 和 github 操作来构建 React Native 博览会项目。但我遇到了如下所述的错误,并且找不到任何解决方案。
> React Native: 0.72.0
> Expo: 49.0.15
> runs-on: macos-latest
> node-version: \[16.x\]
> ruby-version: 3.0.2
> uses: maierj/[email protected]\
这是错误日志
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'AppAuth' from project 'Pods')
1072/Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'RNCAsyncStorage' from project 'Pods')
1073** ARCHIVE FAILED **
1074
1075Warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
1076/Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'RNScreens' from project 'Pods')
1077[10:44:48]: Exit status: 65
1078
1079[!] Error building the application - see the log above
1080[10:44:48]:
1081[10:44:48]: Maybe the error shown is caused by using the wrong version of Xcode
1082[10:44:48]: Found multiple versions of Xcode in '/Applications/'
1083[10:44:48]: Make sure you selected the right version for your project
1084[10:44:48]: This build process was executed using '/Applications/Xcode_15.0.1.app'
1085[10:44:48]: If you want to update your Xcode path, either
1086[10:44:48]:
1087[10:44:48]: - Specify the Xcode version in your Fastfile
1088[10:44:48]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
1089[10:44:48]:
1090[10:44:48]: - Specify an absolute path to your Xcode installation in your Fastfile
1091[10:44:48]: ▸ xcode_select "/Applications/Xcode8.app"
1092[10:44:48]:
1093[10:44:48]: - Manually update the path using
1094[10:44:48]: ▸ sudo xcode-select -s /Applications/Xcode.app
1095[10:44:48]:
1096
1097+------------------------------------------------+
1098| Build environment |
1099+---------------+--------------------------------+
1100| xcode_path | /Applications/Xcode_15.0.1.app |
1101| gym_version | 2.221.0 |
1102| export_method | app-store |
1103| sdk | iPhoneOS17.0.sdk |
1104+---------------+--------------------------------+
1105
1106[10:44:48]: ▸ /Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'GTMAppAuth' from project 'Pods')
1107[10:44:48]: ▸ /Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'AppAuth' from project 'Pods')
1108[10:44:48]: ▸ /Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'RNCAsyncStorage' from project 'Pods')
1109[10:44:48]: ▸ /Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
1110[10:44:48]: ▸ /Users/runner/work/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'RNScreens' from project 'Pods')
1111[10:44:48]:
1112[10:44:48]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
1113[10:44:48]: 📋 For the complete and more detailed error log, check the full log at:
1114[10:44:48]: 📋 /Users/runner/Library/Logs/gym/build.log
1115[10:44:48]:
1116[10:44:48]: Looks like fastlane ran into a build/archive error with your project
1117[10:44:48]: It's hard to tell what's causing the error, so we wrote some guides on how
1118[10:44:48]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
1119[10:44:48]: Before submitting an issue on GitHub, please follow the guide above and make
1120[10:44:48]: sure your project is set up correctly.
1121[10:44:48]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
1122[10:44:48]: the full commands printed out in yellow in the above log.
1123[10:44:48]: Make sure to inspect the output above, as usually you'll find more error information there
1124[10:44:48]:
1125+----------------------------------------------------------------------------------------------------------+
1126| Lane Context |
1127+------------------------------------+---------------------------------------------------------------------+
1128| PLATFORM_NAME | ios |
1129| LANE_NAME | ios testflight |
1130| KEYCHAIN_PATH | ~/Library/Keychains/temp_keychain_username |
1131| BUILD_NUMBER | 24 |
1132| VERSION_NUMBER | 1.0.1 |
1133| SIGH_PROFILE_TYPE | app-store |
1134| MATCH_PROVISIONING_PROFILE_MAPPING | {"***"=>"match AppStore ***"} |
1135+------------------------------------+---------------------------------------------------------------------+
1136[10:44:48]: Called from Fastfile at line 195
1137[10:44:48]: ```
1138[10:44:48]: 193: teamid: ENV['APPLE_TEAM_ID']
1139[10:44:48]: 194: )
1140[10:44:48]: => 195: build_app(
1141[10:44:48]: 196: clean: true, # Ensure clean build
1142[10:44:48]: 197: export_team_id: ENV['APPLE_TEAM_ID'],
1143[10:44:48]: ```
1144[10:44:48]: Error building the application - see the log above
1145
1146+--------------------------------------------------+
1147| fastlane summary |
1148+------+-----------------------------+-------------+
1149| Step | Action | Time (in s) |
1150+------+-----------------------------+-------------+
1151| 1 | create_keychain | 0 |
1152| 2 | increment_build_number | 0 |
1153| 3 | increment_version_number | 0 |
1154| 4 | cocoapods | 178 |
1155| 5 | app_store_connect_api_key | 0 |
1156| 6 | sync_code_signing | 3 |
1157| 7 | update_project_provisioning | 0 |
1158| 8 | update_project_team | 0 |
1159| 💥 | build_app | 29 |
1160+------+-----------------------------+-------------+
1161
1162[10:44:48]: fastlane finished with errors
1163Error: Error: Executing lane ios testflight failed.
1164Error: Executing lane ios testflight failed.
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
platform :ios do
desc "iOS Build and Deploy to TestFlight"
lane :testflight do
# xcodes(
# version: "15.4",
# select_for_current_build_only: true
# )
keychain_name = "temp_keychain_username"
keychain_password = "temp_keychain_password"
ensure_temp_keychain(keychain_name, keychain_password)
# Debugging logs for environment variables
puts "Environment Variables:"
puts "APPLE_API_KEY_ID: #{ENV['APPLE_API_KEY_ID']}"
puts "APPLE_ISSUER_ID: #{ENV['APPLE_ISSUER_ID']}"
puts "BUNDLE_ID: #{ENV['BUNDLE_ID']}"
puts "APPLE_TEAM_ID: #{ENV['APPLE_TEAM_ID']}"
puts "GIT_PERSONAL_ACCESS_TOKEN: #{ENV['GIT_PERSONAL_ACCESS_TOKEN'] ? 'Present' : 'Missing'}"
increment_build_number(
xcodeproj: xcodeproj,
build_number: ENV['BUILD_NUMBER']
)
increment_version_number(
xcodeproj: xcodeproj,
version_number: ENV['VERSION_NUMBER']
)
cocoapods(
clean_install: false,
podfile: File.absolute_path('../ios/Podfile')
)
api_key = app_store_connect_api_key(
key_id: ENV['APPLE_API_KEY_ID'],
issuer_id: ENV['APPLE_ISSUER_ID'],
key_filepath: File.absolute_path("../AppleApiKey.p8"),
duration: 1200,
in_house: false
)
sync_code_signing(
type: "appstore",
team_id: ENV['APPLE_TEAM_ID'],
app_identifier: ENV['BUNDLE_ID'],
git_basic_authorization: Base64.strict_encode64(ENV['GIT_PERSONAL_ACCESS_TOKEN']),
keychain_name: keychain_name,
keychain_password: keychain_password,
git_url: github_match_url,
api_key: api_key
)
update_project_provisioning(
xcodeproj: xcodeproj,
target_filter: ios_app_scheme,
profile: ENV["sigh_#{ENV['BUNDLE_ID']}_appstore_profile-path"],
build_configuration: "Release"
)
update_project_team(
path: xcodeproj,
teamid: ENV['APPLE_TEAM_ID']
)
build_app(
clean: true, # Ensure clean build
export_team_id: ENV['APPLE_TEAM_ID'],
configuration: "Release",
workspace: xcworkspace,
scheme: ios_app_scheme,
export_method: "app-store",
export_options: {
provisioningProfiles: {
ENV['BUNDLE_ID'] => appstore_provision_file
}
}
)
upload_to_testflight(
apple_id: ENV['APPLE_APP_ID'],
app_identifier: ENV['BUNDLE_ID'],
skip_waiting_for_build_processing: true,
skip_submission: true,
distribute_external: false,
notify_external_testers: false
)
version = get_version_number(xcodeproj: xcodeproj)
build = get_build_number(xcodeproj: xcodeproj)
clean_build_artifacts
git_commit(
path: [File.absolute_path(plist_file_path)],
message: ios_commit_message
)
push_to_git_remote
delete_temp_keychain(keychain_name)
end
end
看起来主要问题是 iOS 部署目标设置为 11.0。尝试使用 podfile 上的代码:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
之后执行以下代码片段
pod install
npx expo prebuild --clean
希望有帮助。