Skip to content

Latest commit

 

History

History
79 lines (49 loc) · 1.47 KB

File metadata and controls

79 lines (49 loc) · 1.47 KB

套件

react-native-firebase

GitHub: https://github.com/invertase/react-native-firebase

文件: https://rnfirebase.io/docs

安裝

npm install --save react-native-firebase

整合

Basic

  1. 下載 Firebase 專案 iOS 應用程式的 GoogleService-Info.plist,並將檔案放到 ios/[YOUR APP NAME]/GoogleService-Info.plist

  2. 開啟 Xcode ,將 GoogleService-Info.plist 檔案從 finder 拖曳到專案中

  3. 編輯 ios/[YOUR APP NAME]/AppDelegate.m 最上方加入

#import <Firebase.h>

找到 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method

在 method 中開頭處加入

[FIRApp configure];
  1. 安裝 CocoaPods (已經安裝可以略過)
sudo gem install cocoapods
  1. 初始化 Podfile
cd ios && pod init
  1. 修改 Podfile

  2. 取消這行註解
platform :ios, '9.0'
  1. 加入這行
# Required by RNFirebase
pod 'Firebase/Core', '~> 5.11.0'
  1. link
react-native link react-native-firebase

Messaging Module

參考: https://rnfirebase.io/docs/v5.x.x/messaging/ios

Notification Module

參考: https://rnfirebase.io/docs/v5.x.x/notifications/ios