Abhishek Agarwal
08/26/2025, 6:41 PMNSBundle
to read custom keys like BASE_URL
and IS_DEBUG
from Info.plist
, which works fine when I build with Xcode. However, when I run the same code via Android Studio, those keys return null.
//iosMain inside actual class
private fun getBaseUrlFromBundle(): String {
val bundle = NSBundle.Companion.mainBundle
val baseUrl = bundle.objectForInfoDictionaryKey("BASE_URL") as? String
return baseUrl ?: ""
}
private fun getEnvironmentFromBundle(): Environment {
val bundle = NSBundle.Companion.mainBundle
val isDebug = bundle.objectForInfoDictionaryKey("IS_DEBUG") as? String
return if (isDebug?.lowercase() == "true") Environment.STAGE else Environment.PROD
}