gpt4 book ai didi

ios - 如何在 iOS Swift 中根据环境设置不同的 Google-Service-info-plist 文件?

转载 作者:行者123 更新时间:2023-11-28 11:24:54 26 4
gpt4 key购买 nike

我想在同一个项目中为不同的环境设置不同的 google-service-plist 文件以进行 firebase 集成

最佳答案

struct Configuration {
static var environment: Environment = {
return Environment.init(rawValue: Bundle.main.object(forInfoDictionaryKey: "Configuration") as! String)!
}()

static var documentsDir: String {
guard let dir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first else { fatalError("There was something wrong finding the documents directory") }
return dir
}
}

enum Environment: String {

case local = "Local"
case production = "Production"

var googlePlistFileName: String {
switch self {
case .local:
return "GoogleServiceMobileLocal"
case .production:
return "GoogleServiceMobileProduction"
}
}
}

我在 info-plist 文件中添加了一个键 enter image description here

关于ios - 如何在 iOS Swift 中根据环境设置不同的 Google-Service-info-plist 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58516306/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com