簡體   English   中英

在Firebase中等效於目標C的快速代碼

[英]Equivalent of swift code in firebase to objective c

當您只有一個目標時,Firebase建議使用此功能來支持多個環境。 不過這是很快的,因為目標本機中的appledelegate.m不使用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)

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM