I’ve got a Kotlin Framework which is calling containerURLForSecurityApplicationGroupIdentifier()
, however it doesn’t work (return is null).
However, if a call to this function it is made directly from the app’s Swift or Obj-C code then it does.
Here’s the Kotlin code which illustrates the issue:
import platform.Foundation.NSFileManager
fun doit() {
val identifier = NSFileManager.defaultManager.containerURLForSecurityApplicationGroupIdentifier("group.com.mycompany.myapp")
logger.info { "$identifier " }
}
The above doesn’t work, identifier is [] after calling.
And here’s some equivalent Swift code
let identifier = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.mycompany.myapp")
The above code works as expected hence verifying the Xcode project is configured correctly with the app group.
Other functions within NSFileManager are working as expected when called from the Kotlin code, its only this one in particular that doesn’t work.
Any idea why it doesn’t work?
(I would be able to work around the issue – for example the native code could run this, write it to defaults for example, which the Kotlin code then reads from, rather than the Kotlin code call the function directly, but I’m curious why it doesn’t work)