What’s the correct/safe way to get a `CFStringRef`...
# ios
p
What’s the correct/safe way to get a
CFStringRef
(like the
kCFBundleNameKey
constant) as a Kotlin
String
?
p
Thanks, @Nikolay Kasyanov , I found that before and have tried using
CFBridgingRelease
however I found it crashes occasionally - I assume because it’s changing the ownership of the constant pointer? I assume it would be safer to create a copy of the string each time (or cache it) ?
n
I’m just using a string literal instead of a constant, works like a charm
https://youtrack.jetbrains.com/issue/KT-38528#focus=streamItem-27-4109183.0-0 there’s also an option to add a
CFBridgingRetain
call to balance for the release
p
I think a set of constant string literals in the kotlin code would probably be safer. I doubt they’ll change the values any time soon 😉
n
exactly
180 Views