Flutter:Integrate the Flutter project and Firebase   2019-08-28


Open Xcode

當Flutter專案要與Firebase專案進行串聯時,我們必須在Firebase填入iOS Bundle ID,而這ID需要開啟Xcode來取得。

  1. 在Flutter專案已經建立好的前提下,打開Xcode,並點擊Open another project…

  2. 開啟Flutter中的Runner.xcodeproj,路徑為:$flutter_project/ios/Runner.xcodeproj

  3. 雙擊目錄列的Runner,右側即可查看Bundle Identifier

Add profile in Firebase

欄位輸入完成後即可下載設定檔,並將下載的設定檔放入Xcode專案的根目錄中。

Firebase SDK

跟著網頁步驟進行處理。

在Podfile加入此設定:

1
2
3
4
5
6
7
# Add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'

# Add the pods for any other Firebase products you want to use in your app
# For example, to use Firebase Authentication and Cloud Firestore
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
1
pod install

接著一樣跟著網頁的步驟進行就好
最後一個步驟時需要build flutter project完成與firebase的整合。

Error

如果import Firebase總是錯誤的話
參考Error: Could not build Objective-C module ‘Firebase’

Could not hardlink copy...
參考XCode Could not hardlink copy

Reference

Flutter: Firebase Tutorial Part 1 | Auth and Sign in

How to integrate your iOS Flutter App with Firebase on MacOS

目錄

  1. Open Xcode
  2. Add profile in Firebase
  3. Firebase SDK
  4. Error
  5. Reference