我的開發環境如下:
- Mac Mini M1
- Mac OS 蒙特雷
- 視覺作業室代碼
- 顫振 2.8.0
- iPhone 12 Pro Max(iOS 模擬器)
Flutter 依賴:依賴:flutter:sdk:flutter cupertino_icons:^1.0.2 firebase_core:^1.10.5 firebase_auth:^3.3.3 google_sign_in:^5.2.1 flutter_login_facebook:^1.2.0
provider:^6.0.1
當我嘗試構建和運行應用程式時,出現以下錯誤:
在除錯模式下在 iPhone 12 Pro Max 上啟動 lib/main.dart……Xcode 構建完成。18.5s 無法構建 iOS 應用程式 Xcode 構建的錯誤輸出:? ** BUILD FAILED ** Xcode 的輸出:? /Users/daoudmalikyar/Documents/dev/Udemy/flutter_firebase/time_tracker/ios/Runner/GeneratedPluginRegistrant.m:12:9 :致命錯誤:未找到模塊“firebase_auth”@import firebase_auth;~~~~~~~^~~~~~~~~~~~~ 產生了 1 個錯誤。注意:使用新構建系統注意:規劃注意:構建準備完成注意:并行構建目標/Users/daoudmalikyar/Documents/dev/Udemy/flutter_firebase/time_tracker/ios/Pods/Pods.xcodeproj:警告:iOS模擬器部署目標'IPHONEOS_DEPLOYMENT_TARGET' 設定為 8.0,但支持的部署目標版本范圍為 9.0 到 15.0.99。(在目標' AppAuth' 來自專案 'Pods') /Users/daoudmalikyar/Documents/dev/Udemy/flutter_firebase/time_tracker/ios/Pods/Pods.xcodeproj: 警告:iOS 模擬器部署目標 'IPHONEOS_DEPLOYMENT_TARGET' 設定為 8.0,但范圍支持的部署目標版本是 9.0 到 15.0.99。(在專案“Pods”的目標“GoogleSignIn”中)無法為模擬器構建應用程式。在 iPhone 12 Pro Max 上啟動應用程式時出錯。退出(sigterm)) 無法為模擬器構建應用程式。在 iPhone 12 Pro Max 上啟動應用程式時出錯。退出(sigterm)) 無法為模擬器構建應用程式。在 iPhone 12 Pro Max 上啟動應用程式時出錯。退出(sigterm)
我嘗試了在網路上找到的幾個潛在修復程式,但似乎沒有一個可以解決問題。同樣,這段代碼在 2.5.3 下運行良好。當我嘗試在 XCode 中構建專案時,我遇到了相同的錯誤,即未找到“firebase_auth”。任何建議表示贊賞。
謝謝。
uj5u.com熱心網友回復:
我設法通過向 ios/Podfile 添加三行來讓它作業:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386"
end
end
end
查看此評論以獲取更多資訊:https : //github.com/flutter/flutter/issues/94914#issuecomment-992898782
uj5u.com熱心網友回復:
嘗試以下步驟:
flutter cleancd iosrm -rf Podfile.lock- 將您的 Podfile 替換為下方的 Podfile 并在第二行中設定目標 iOS 平臺
pod installcd ..flutter run
播客檔案
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
puts 'Determining pod project minimal deployment target'
pods_project = installer.pods_project
deployment_target_key = 'IPHONEOS_DEPLOYMENT_TARGET'
deployment_targets = pods_project.build_configurations.map{ |config| config.build_settings[deployment_target_key] }
minimal_deployment_target = deployment_targets.min_by{ |version| Gem::Version.new(version) }
puts 'Minimal deployment target is ' minimal_deployment_target
puts 'Setting each pod deployment target to ' minimal_deployment_target
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings[deployment_target_key] = minimal_deployment_target
end
end
end
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/381730.html
