2016-08-02 7 views
4

私はDevとProdのスキームをFirebaseのさまざまなアプリケーションとして登録しました。私はそれらを別々にしたい、それぞれ固有のバンドルIDを持つ。私はそれがdevかprodスキームかどうかを識別するために#if devを使用しています。どのように私はその計画のための専用のplistとfirebaseを初期化できますか?複数のGoogleService-Infoのサポート

答えて

5

だけ使用[FIRApp configureWithOptions:]

NSString *firebasePlist = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; 

#if STAGING 
    firebasePlist = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-DEV" ofType:@"plist"]; 
#endif 

FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:firebasePlist]; 
[FIRApp configureWithOptions:options]; 
1

使用

var firebasePlist: String? = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist") 
if development == true{ 
firebasePlist = Bundle.main.path(forResource: "GoogleService-Info-DEV", ofType: "plist") 
} 
var options = FIROptions(contentsOfFile: firebasePlist) 
FIRApp.configure(with: options) 

いますが、DEV GoogleServiceを使用したいときには、真の値と発展という変数を持っている必要がありますplistとfalseの値は、通常のGoogleService plistを使用したいですか?

+0

ああ、それは私の答えです –

関連する問題