在我的react原生项目中,我尝试添加多个firebase服务,但是我收到一个错误
'FirebaseStorage/FirebaseStorage-Swift.h' file not found
Package.josn
"@react-native-firebase/app": "^16.4.3",
"@react-native-firebase/auth": "^16.4.3",
"@react-native-firebase/crashlytics": "^16.4.3",
"@react-native-firebase/database": "^16.4.3",
"@react-native-firebase/dynamic-links": "^16.4.3",
"@react-native-firebase/firestore": "^16.4.3",
"@react-native-firebase/messaging": "^16.4.3",
"@react-native-firebase/storage": "^16.4.3",
播客文件
pod_folder = Pathname.new(__FILE__).dirname.realpath
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
require File.join(File.dirname(`cd #{pod_folder} && node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`cd #{pod_folder} && node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`cd #{pod_folder} && node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
platform :ios, '12.1'
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseAppCheckInterop', :modular_headers => true
pod 'FirebaseAuthInterop', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'GTMSessionFetcher', :modular_headers => true
require 'json'
podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}
target 'MyApp' do
use_expo_modules!
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes'
)
target 'MyAppTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!({ 'Flipper' => '0.95.0', 'Flipper-Folly' => '2.6.7', 'Flipper-DoubleConversion' => '3.1.7' })
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
## Fix for XCode 12.5
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
"RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
end
react_native_post_install(installer)
endMyApp
end
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
如果我删除@react-native-firebase/storage模块,应用程序将再次运行。
1条答案
按热度按时间kupeojn61#
您可能需要更改Podfile中的某些内容:
将use_frameworks!替换为use_frameworks!:linkage =〉:static将$RNFirebaseAsStaticFramework = true从文件顶部移动到use_frameworks的下一行取消注解行:flipper_configuration =〉Flipper配置。已启用,并将已启用替换为已禁用
更多信息:https://github.com/invertase/react-native-firebase/issues/6382#issuecomment-1276756506