架构为arm64的未定义符号:“_OBJC_CLASS_$_FlutterError”

3
我想在Flutter应用程序中实现图像通知。我使用this doc设置了一切,当我在真实设备上运行时,图像通知起作用。
但是,当我尝试归档构建时,我遇到了这个错误。只有在删除MyImageNotification目标后,我才能成功归档。

enter image description here

这是当我完成Imagg通知设置后文件夹结构的样子 enter image description here 我从错误日志底部得到以下信息。
ld: warning: Could not find or use auto-linked framework 'Flutter'
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FlutterError", referenced from:
      objc-class-ref in firebase_core(FLTFirebasePlugin.o)
      objc-class-ref in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
  "_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
      objc-class-ref in firebase_core(FLTFirebaseCorePlugin.o)
      objc-class-ref in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
      objc-class-ref in firebase_messaging(FLTFirebaseMessagingPlugin.o)
  "_FlutterMethodNotImplemented", referenced from:
      -[FLTFirebaseCorePlugin handleMethodCall:result:] in firebase_core(FLTFirebaseCorePlugin.o)
      -[FLTFirebaseDynamicLinksPlugin handleMethodCall:result:] in firebase_dynamic_links(FLTFirebaseDynamicLinksPlugin.o)
      -[FLTFirebaseMessagingPlugin handleMethodCall:result:] in firebase_messaging(FLTFirebaseMessagingPlugin.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的 Podfile 看起来像这样。

# Uncomment this line to define a global platform for your project
# 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!

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

target 'MyImageNotification' do
use_frameworks!

pod 'Firebase/Messaging'
end



你使用构建变体吗? - Alex Verbitski
是的,我会。请问您需要翻译什么内容? - gowtham6672
@lesha-native 我添加了一些错误,这可能有助于更好地理解。 - gowtham6672
2个回答

3

可能的解决方案 #1

尝试在ios文件夹中执行以下步骤:

  1. rm -rf Pods/ Podfile.lock .symlinks Flutter/Flutter.podspec Runner.xcworkspace
  2. pod repo update
  3. pod install
  4. 运行归档

可能的解决方案 #2

如果上述步骤无法帮助,请确保您的目标品味的“仅构建活动架构”设置为“否”

enter image description here

可能的解决方案 #3

想法是提高目标ios版本。 在您的Podfile中设置:

platform :ios, '10.0'

并修改您的安装后脚本如下:

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['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
    end
  end
end

然后重新安装 pods (pod deintegrate, pod install)

谢谢。尝试了那两种方法,但是没有成功。 - gowtham6672
我猜测架构设置可能出问题了。尽管我找不到具体原因。 - gowtham6672
另外,第三种方法不起作用。当我删除MyImageNotification文件时,可以构建存档。使用图像通知时,无法进行归档。 - gowtham6672

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接