我一直在尝试将flearbase添加到我的flutter应用程序中,但是在此之前,我必须先转到Xcode并添加一些内容以便能够为iOS钩连firebase。我已经尝试了导入语句,但是没有用。该代码是Dart代码。
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
import Firebase;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
override init() {
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true
}
@end
This what I added and did not work and also the import did not work
override init() {
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true
}
答案 0 :(得分:0)
假设您使用CocoaPod作为依赖项管理器。
pod初始化
pod“ Firebase / Core”
现在应该可以使用。
答案 1 :(得分:0)
您唯一需要做的就是将firebase plist文件GoogleService-Info.plist
放在ios/Runner
文件夹中。将Firebase依赖项添加到您的pubspec.yaml
文件中,然后运行flutter packages get
,这将为您安装依赖项并运行pod install。如果您过去曾在IOS中使用过Firebase,并且没有进行更新,那么也许可以使用pod update Firebase
请记住,此后请完全重新启动您的应用。
处阅读此信息