2017-03-04 64 views
0

當您只有一個目標時,Firebase建議使用它來支持多個環境。儘管這很快,但是由於反應原生中的appledelegate.m並不使用swift,因此目標c會是什麼。firebase中的swift代碼等效於目標c

let filePath = Bundle.main.path(forResource: "MyGoogleService", ofType: "plist") 
guard let fileopts = FIROptions.init(contentsOfFile: filePath) 
    else { assert(false, "Couldn't load config file") } 
FIRApp.configure(with: fileopts) 

回答

3

在Objective-C中,你可以這樣寫。

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MyGoogleService" ofType:@"plist"]; 
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; 
[FIRApp configureWithOptions:options];