【发布时间】:2020-12-21 14:55:55
【问题描述】:
我已将 Flutter 更新到最新版本 1.20,并执行了 Xcode 11.4 支持的步骤。执行这些步骤后,出现与架构相关的错误。
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIRAnalytics", referenced from:
objc-class-ref in firebase_analytics(FLTFirebaseAnalyticsPlugin.o)
(maybe you meant: _OBJC_CLASS_$_FIRAnalyticsConfiguration)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
- 颤振医生:
[✓] Flutter (Channel stable, 1.20.0, on Mac OS X 10.15.6 19G73, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.6)
[✓] IntelliJ IDEA Community Edition (version 2019.2.2)
[✓] Connected device (2 available)
• No issues found!
另外,我在 pubspec.yaml 中使用了最新版本的 firebase_analytics: ^6.0.0。
- iOS Podfile:
platform :ios, '9.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!
pod 'Firebase/Core'
pod 'NVActivityIndicatorView', '~> 4.8.0'
pod 'SwiftyUserDefaults', '~> 3.0.0'
pod 'RSMasterTableView', :git => 'https://github.com/DhavalRKansara/RSMasterTableView.git'
pod 'CryptoSwift'
pod 'SwiftR' , :git => 'https://github.com/DhavalRKansara/SwiftR.git'
pod 'SKPhotoBrowser'
pod 'RSSelectionMenu'
pod 'JJFloatingActionButton'
pod 'MaterialComponents/TextFields'
pod 'MarqueeLabel'
pod 'Firebase/Analytics'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
注意:我也在 GitHub 上的 flutterfire 下提出了和issue 相同的问题。
【问题讨论】: