I make feature that fetch configs from firebase remote config store. but I got a result that emptry value for some key. so i debug process that fetching values and find singleton instance for RemoteConfig points address 0x00000000.. and if i print this object app crashed and showed error "bad access". I dont know why this happen because i followed all procedure that firebase docs offers. help me if you get same problem with me thanks.
initially, i called below funcition before launches.
func configureFirebase() {
FirebaseApp.configure()
// Setup remote config
do {
let settings = RemoteConfigSettings()
let config = RemoteConfig.remoteConfig()
config.configSettings = settings
try config.setDefaults(from: [
"alarm_mission_type": "shake_mission"
])
config.fetchAndActivate()
} catch {
debugPrint("Remote config 기본값 설정 오류 \(error.localizedDescription)")
}
}
and below code is using config value code.
let config = RemoteConfig.remoteConfig()
config.fetchAndActivate()
let configValue = config["alarm_mission_type"].stringValue
print(config) // app crashed and showed error "bad access"
Answer myself,
this is caused by compiler's optiomization.
Firebase frameworks register them self by calling load method static method for Service component(Objective-C code, automatically called on runtime).
framwork's components files actally not using directly so build setting in Tuist ignore Component file. and so registration not worked.
So we should add Other linker flag field a value '-ObjC'. this flag compile Objective-C file in static library imported to this executable.