我想在 Flutter 应用中实现图像通知。我使用此文档设置了所有内容,当我运行真实设备时,图像通知有效。但是,当我尝试存档构建时,我
我想在 Flutter 应用中实现图像通知。我使用 此文档 ,当我运行真实设备时,图像通知有效。
但是,当我尝试存档构建时,我收到此错误。只有删除 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
可能的解决方案 #1
在 ios 文件夹内尝试:
可能的解决方案 #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
然后重新安装 pods( pod deintegrate
, pod install
)