IOS Podfile 中的 firebase 消息包错误
firebase messaging package error in IOS Podfile
应用程序工作正常,但是当我添加 firebase 消息包 10.0.0 时,控制台出现错误并且应用程序无法打开。已经尝试过之前 post 中提到的许多与此类似的事情,但对我来说没有任何效果。已尝试 deleting/removing pod 文件和文件夹,然后 repo update , flutter clean 但仍然遇到此错误并且无法构建应用程序并在启动时出错。请帮助..
Xcode's output:
↳
/Users/gagansingh/Desktop/projectApp/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/FIRMessagingPubSub.m:229:26: error: definition of 'GULSecureCoding' must be imported from module 'GoogleUtilities.GULSecureCoding' before it is required
NSData *pendingData = [GULSecureCoding archivedDataWithRootObject:topicsList error:&error];
^
In module 'GoogleUtilities' imported from /Users/gagansingh/Desktop/projectApp/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/FIRMessagingPubSub.m:20:
/Users/gagansingh/Desktop/projectApp/ios/Pods/GoogleUtilities/GoogleUtilities/Environment/Public/GoogleUtilities/GULSecureCoding.h:22:12: note: definition here is not reachable
@interface GULSecureCoding : NSObject
播客文件:-
# 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'
pod 'Google-Mobile-Ads-SDK'
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
如果有人试图实现 same.These 是我在 pod 文件中所做的以下更改。首先删除 Podfile.lock 和 Pods 文件夹,并按照此处所做的那样在 pod 文件中进行更改,然后 flutter clean 然后再次 运行。您可能会再次遇到错误,因为它不会找到 pods 文件夹和 pods file.lock 并且必须自己创建新的文件夹。检查这些是否已创建,然后再次 运行。在所有这一切之前,你必须添加 firebase_analytics 与你在 pubspec.ymal 中添加其他 firebase 包相同的版本,无论你是否使用它。
# 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'
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Core'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/Auth'
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_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 'ImageNotification' do
pod 'Firebase/Messaging'
end
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
至
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
应用程序工作正常,但是当我添加 firebase 消息包 10.0.0 时,控制台出现错误并且应用程序无法打开。已经尝试过之前 post 中提到的许多与此类似的事情,但对我来说没有任何效果。已尝试 deleting/removing pod 文件和文件夹,然后 repo update , flutter clean 但仍然遇到此错误并且无法构建应用程序并在启动时出错。请帮助..
Xcode's output:
↳
/Users/gagansingh/Desktop/projectApp/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/FIRMessagingPubSub.m:229:26: error: definition of 'GULSecureCoding' must be imported from module 'GoogleUtilities.GULSecureCoding' before it is required
NSData *pendingData = [GULSecureCoding archivedDataWithRootObject:topicsList error:&error];
^
In module 'GoogleUtilities' imported from /Users/gagansingh/Desktop/projectApp/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/FIRMessagingPubSub.m:20:
/Users/gagansingh/Desktop/projectApp/ios/Pods/GoogleUtilities/GoogleUtilities/Environment/Public/GoogleUtilities/GULSecureCoding.h:22:12: note: definition here is not reachable
@interface GULSecureCoding : NSObject
播客文件:-
# 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'
pod 'Google-Mobile-Ads-SDK'
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
如果有人试图实现 same.These 是我在 pod 文件中所做的以下更改。首先删除 Podfile.lock 和 Pods 文件夹,并按照此处所做的那样在 pod 文件中进行更改,然后 flutter clean 然后再次 运行。您可能会再次遇到错误,因为它不会找到 pods 文件夹和 pods file.lock 并且必须自己创建新的文件夹。检查这些是否已创建,然后再次 运行。在所有这一切之前,你必须添加 firebase_analytics 与你在 pubspec.ymal 中添加其他 firebase 包相同的版本,无论你是否使用它。
# 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'
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Core'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/Auth'
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_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 'ImageNotification' do
pod 'Firebase/Messaging'
end
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
至
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end