Getting a few iOS crash reports that seem to be re...
# multiplatform
j
Getting a few iOS crash reports that seem to be related to use of mutliplatform settings library while in the background (or at least that's how it manifests but could easily be something we're doing wrong as well).....just in case anyone has come across this.....more in đŸ§”
Copy code
0                	0x1070d3aec kfun:kotlin.Throwable#<init>(kotlin.String?){} + 100 (Throwable.kt:30)
1                	0x1070cd998 kfun:kotlin.Exception#<init>(kotlin.String?){} + 96 (Exceptions.kt:23)
2                	0x1070cdb68 kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 96 (Exceptions.kt:34)
3                	0x1070ce0a0 kfun:kotlin.IllegalStateException#<init>(kotlin.String?){} + 96 (Exceptions.kt:70)
4                	0x107f809b8 kfun:kotlin#error(kotlin.Any){}kotlin.Nothing + 84 (Preconditions.kt:145)
5                	0x107f809b8 kfun:com.russhwolf.settings.KeychainSettings.checkError#internal + 1404 (KeychainSettings.kt:286)
6                	0x107f7f08c <inlined-out:<anonymous>> + 1248 (KeychainSettings.kt:255)
7                	0x107f7f08c <inlined-out:<anonymous>> + 1340 (KeychainSettings.kt:319)
8                	0x107f7f08c kfun:kotlinx.cinterop#memScoped(kotlin.Function1<kotlinx.cinterop.MemScope,0:0>){0§<kotlin.Any?>}0:0 + 1420 (Utils.kt:718)
9                	0x107f7f08c kfun:com.russhwolf.settings#cfRetain(kotlin.Any?;kotlin.Function2<kotlinx.cinterop.MemScope,kotlinx.cinterop.CPointer<out|kotlinx.cinterop.CPointed>?,0:0>){0§<kotlin.Any?>}0:0 + 1432 (KeychainSettings.kt:316)
10               	0x107f7f08c kfun:com.russhwolf.settings.KeychainSettings.getKeychainItem#internal + 2092 (KeychainSettings.kt:248)
11               	0x107f7a8bc kfun:com.russhwolf.settings.KeychainSettings#getStringOrNull(kotlin.String){}kotlin.String? + 264 (KeychainSettings.kt:186)
12               	0x107f8a114 kfun:com.russhwolf.settings.Settings#getStringOrNull(kotlin.String){}kotlin.String?-trampoline + 108 (Settings.kt:119)
13               	0x108c611e4
f
Do you have the main reason of the exception ? You just give the stack, not the message
j
just get
Copy code
Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
looks to be triggered here wiw in
KeychainSettings
Copy code
private fun OSStatus.checkError(vararg expectedErrors: OSStatus) {
        if (this != 0 && this !in expectedErrors) {
            val cfMessage = SecCopyErrorMessageString(this, null)
            val nsMessage = CFBridgingRelease(cfMessage) as? NSString
            val message = nsMessage?.toKString() ?: "Unknown error"
            error("Keychain error $this: $message")
        }
    }
f
Do you use the secure keychain of iOS?
j
This seems to be happening internally in the multiplatform settings library and code seems to work fine normally.....only seems to happen when this is run when app is in the background
f
There is a lot of use case with the background. I’m not sure about his usage with this library, it can be a bug. Add some logs to isolate the bad settings. Also, if you’re using securekeychain, check the policy you are using.
You should have the message “Keychain error $this : $message” somewhere, no trace?
j
so, this is based on a submitted crash report in appstore connect.....don't have logs and haven't been able to reproduce yet
f
Well, the KMP crash is not correctly sent to the crash reporter, as usual 😄 . The real reason “Keychain error...” is here.
My guess, it’s a security issue about the policy your keychain uses, but it’s just a guess.
j
thanks, will keep digging
r