2020-4-2
1 : 按照官方文档 :https://firebase.google.com/docs/flutter/setup
除了。Cloud Messaging , 其他都可以用 iOS simulator 测试
2: 在 firebase 新建项目 , 用 flutter—-》 iOS 的 bundle id 和 此项目绑定在一起
3 : 完成后下载。GoogleService-Info.plist 文件 , 然后用 Xcode 打开。/flutter/iOS/runner.xcworkspace , 把 plist 文件添加到。runner/runner 下面。
4: 安装。cocoapods。 这是一个ruby程序, 用来下载google firebase 需要的插件
1 |
sudo gem install cocoapods -v 1.7.5 |
1 |
pod setup |
这2个命令用时很长 , in my case , 3小时以上
5 用 vscode 打开flutter 程序。 在 pubspec.yaml 文件增加新的package
1 2 3 |
firebase_core: ^0.4.0+9 firebase_auth: ^0.14.0+5 cloud_firestore: ^0.12.9+5 |
保存后等待 flutter 自动完成 flutter pub get 的工作。 get完成后 会自动生成 podfile文件。
6。此时即可执行。flutter run
7 如果安装 grpc 时间过长 , 可以
I resolved it by deleting all the cache related to gRPC at /Users/<user>/Library/Caches/CocoaPods/Pods/Release/
and .../Specs/Release/
, and running pod install
again.