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

Posted

技术标签:

【中文标题】架构 arm64 的未定义符号:“_OBJC_CLASS_$_FlutterError”【英文标题】:Undefined symbols for architecture arm64:"_OBJC_CLASS_$_FlutterError" 【发布时间】:2022-01-13 16:47:29 【问题描述】:

我想在 Flutter 应用中实现图像通知。我使用this doc 设置了所有内容,当我运行真实设备时,图像通知有效。 ​

但是,当我尝试存档构建时,我收到了这个错误。仅当我删除 MyImageNotification 目标时,我才能存档。

这是我完成 imagg 通知设置后的文件夹结构

我从错误日志底部收到以下消息

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


【问题讨论】:

你使用构建风格吗? 是的。我做@lesha-native @lesha-native 我添加了一些错误。这可能有助于更好地理解 【参考方案1】:

请看类似的问题:https://github.com/flutter/flutter/issues/95256

【讨论】:

【参考方案2】:

可能的解决方案 #1

在 ios 文件夹中尝试:

    rm -rf Pods/Podfile.lock.symlinks Flutter/Flutter.podspec Runner.xcworkspace pod 存储库更新 吊舱安装 运行存档

可能的解决方案 #2

如果上述步骤不起作用,请确保将目标风格的“仅构建活动架构”设置为“否”

可能的解决方案#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

然后重新安装 pod(pod deintegratepod install

【讨论】:

谢谢。尝试了这两种方法。但是,没有用。 我认为arch有问题。设置。虽然我找不到 另外,第三种方法不起作用。删除 MyImageNotification 文件时可以归档构建。带有图像通知,我无法将其存档

以上是关于架构 arm64 的未定义符号:“_OBJC_CLASS_$_FlutterError”的主要内容,如果未能解决你的问题,请参考以下文章

Crashlytics错误:架构arm64的未定义符号

XCode - 架构 armv7 arm64 的未定义符号

架构 arm64 的未定义符号:“cv::String::deallocate()”

删除/重新添加文件,现在我得到架构 arm64 的未定义符号:

Unity AR Foundation Xcode 项目中架构 arm64 的未定义符号

架构 arm64 的未定义符号:Crashlytics (CLSBetaController.o) 中的 CLSBetaController 块调用