https://kotlinlang.org logo
#juul-libraries
Title
# juul-libraries
f

Francis Mariano

05/25/2022, 3:54 PM
Hello everyone. I really need your help, please save me :) I added a new method in appleMain/Adversiment class
Copy code
public val identifierString: String
    get() = identifier.toString()
The following code works fine in debug build , but it crash in release build 😞 I dunno more what to do .
Copy code
withTimeoutOrNull(3000) {
    Scanner().advertisements.filter { it.identifierString == address}.collect{ adv ->
        Log.debug { "scanner - $adv" }
    }
    Log.debug { "scanner - completed" }
}
The exception is
Uncaught Kotlin exception: kotlin.RuntimeException: Unexpected receiver type: kotlin.String
t

travis

05/25/2022, 4:15 PM
Do you have the fullstack trace available to share? Or, do you know which line specifically it is throwing the exception from?
f

Francis Mariano

05/25/2022, 4:45 PM
Copy code
Uncaught Kotlin exception: kotlin.RuntimeException: Unexpected receiver type: kotlin.String
  at 0  shared               0x102b1642f    ThrowInvalidReceiverTypeException + 483 
  at 1  shared               0x102cab253    kfun:br.com.me.stx.data.repositories.bluetooth.BluetoothRepositoryKmmImpl.<no name provided>_1.$collect_2$<anonymous>_2_7COROUTINE$82.invokeSuspend#internal + 371 
  at 2  shared               0x102cab3b3    kfun:br.com.me.stx.data.repositories.bluetooth.BluetoothRepositoryKmmImpl.<no name provided>_1.$collect_2$<anonymous>_2_7$FUNCTION_REFERENCE$167.emit#internal + 351 
  at 3  shared               0x102c20d23    kfun:com.juul.kable.AppleScanner.<no name provided>_1.$collect_2$<anonymous>_2_7$FUNCTION_REFERENCE$326.emit#internal + 691 
  at 4  shared               0x102c204ef    kfun:com.juul.kable.AppleScanner.<no name provided>_1.$collect_2$<anonymous>_2_7COROUTINE$336.invokeSuspend#internal + 527 
  at 5  shared               0x102c2066f    kfun:com.juul.kable.AppleScanner.<no name provided>_1.$collect_2$<anonymous>_2_7$FUNCTION_REFERENCE$325.emit#internal + 327 
  at 6  shared               0x102be88cf    kfun:kotlinx.coroutines.flow.SharedFlowImpl.$collectCOROUTINE$366#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 2535 
  at 7  shared               0x102b00eef    kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 295 
  at 8  shared               0x102bfe807    kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1527 
  at 9  shared               0x102c14a1f    kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$<anonymous>_3$FUNCTION_REFERENCE$401.$<bridge-UNN>invoke(){}#internal + 307 
  at 10 shared               0x102ec28e3    ___6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge234_block_invoke + 451 
  at 11 libdispatch.dylib          0x100f206fb    _dispatch_call_block_and_release + 23 
  at 12 libdispatch.dylib          0x100f21fc3    _dispatch_client_callout + 15 
  at 13 libdispatch.dylib          0x100f308ab    _dispatch_main_queue_drain + 927 
  at 14 libdispatch.dylib          0x100f304fb    _dispatch_main_queue_callback_4CF + 39 
  at 15 CoreFoundation           0x181db2ab3    <redacted> + 11 
  at 16 CoreFoundation           0x181d6ffd7    <redacted> + 2543 
  at 17 CoreFoundation           0x181d82c2f    CFRunLoopRunSpecific + 571 
  at 18 GraphicsServices          0x1a2779987    GSEventRunModal + 159 
  at 19 UIKitCore              0x18457dc4f    <redacted> + 1079 
  at 20 UIKitCore              0x1843173cf    UIApplicationMain + 335 
  at 21 stx              0x10047fb7b    main + 67 
  at 22 dyld                0x100a003cf    0x0 + 4305454031 
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
In Debug build works fine
@travis I solved the issue (I guess). I replace
Copy code
public val identifierString: String
    get() = identifier.toString()
for that
Copy code
public val identifierString: String
    get() = identifier.UUIDString()
I didn't understand the reason.
t

travis

05/25/2022, 7:33 PM
Sorry that I was super busy at work and not able to help you sooner. It is surprising that it would only fail on debug. The
Identifier
type is different for the Apple platform, apparently that type doesn't properly adhere to
toString
. Glad you found the solution and shared it.
f

Francis Mariano

05/25/2022, 7:43 PM
Don't worry. Yeah, so stranger only fail on debug. I just uploaded a new version for the beta testers. Tks a lot
👍 1
20 Views