【问题标题】:Equivalent of swift code in firebase to objective cfirebase 中的 swift 代码等效于目标 c
【发布时间】:2017-03-04 06:14:36
【问题描述】:

Firebase 建议在您只有一个目标时使用它来支持多个环境。不过这是在 swift 上,因为 react-native 中的 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)

【问题讨论】:

    标签: ios objective-c swift react-native


    【解决方案1】:

    在 Objective-C 中你可以这样写。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-20
      • 2015-10-05
      • 2011-12-18
      • 1970-01-01
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多