【发布时间】:2021-07-23 17:22:58
【问题描述】:
这是适用于 ios 的 react-native 应用程序,我想通过使用 firebase 的推送通知来改进它。但是当我通过命令“react-native run-ios”或通过 xcode 构建项目时,它会崩溃。我寻找解决方案,但回答:
( - 打开终端并进入你的项目 ios 目录
- 输入 pod init(如果不存在),然后 pod install
- 打开工作区项目并从 ios 文件夹中删除构建
- 从终端运行 react-native run-ios。) - 不适用于我的项目,我也尝试了命令“pod update”,但也没有帮助。
我附上了两个文件Podfile和AppDeligate.h的内容,可能是它们的问题。
#Podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'appName' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
target 'appNameTests' 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!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'appName-tvOS' do
# Pods for appName-tvOS
target 'appName-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
##AppDeligate.h
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
【问题讨论】:
标签: ios react-native xcode11 firebase-notifications