version: 2.4.0
platform: iOS
Hi, the app crashes when I try to access the “options” field (Firebase.app.options).
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x11523c __exceptionPreprocess
1 libobjc.A.dylib 0x31224 objc_exception_throw
2 CoreFoundation 0x1861d4 -[NSObject(NSObject) __retain_OA]
3 CoreFoundation 0x6352c ___forwarding___
4 CoreFoundation 0x6de60 _CF_forwarding_prep_0
5 xxx 0x3881a48 kfun:dev.gitlive.firebase.FirebaseApp#<get-options>(){}dev.gitlive.firebase.FirebaseOptions + 32 (firebase.kt:32)
I suppose the cause of this issue is the removal of the field trackingID from FirebaseCore in version 12.0.0:
https://github.com/firebase/firebase-ios-sdk/releases/tag/12.0.0
https://github.com/firebase/firebase-ios-sdk/blob/main/FirebaseCore/CHANGELOG.md#firebase-1200
AI
Why Are There No Compilation Errors?
Objective-C (and therefore Kotlin/Native interop) does not verify selector existence at compile time. A call like [FIROptions trackingID] uses dynamic message dispatch, so the compiler has no way of knowing whether the method actually exists until it is invoked at runtime. As a result:
✅ Compilation — succeeds without any errors
✅ Application startup — works fine as long as that code path is not executed
❌ Runtime — the app crashes only when setUserId is called, because that's when [FIROptions trackingID] sends a message to a non-existent selector, resulting in an NSInvalidArgumentException.
version: 2.4.0
platform: iOS
Hi, the app crashes when I try to access the “options” field (Firebase.app.options).
I suppose the cause of this issue is the removal of the field trackingID from FirebaseCore in version 12.0.0:
https://github.com/firebase/firebase-ios-sdk/releases/tag/12.0.0
https://github.com/firebase/firebase-ios-sdk/blob/main/FirebaseCore/CHANGELOG.md#firebase-1200
AI
Why Are There No Compilation Errors?
Objective-C (and therefore Kotlin/Native interop) does not verify selector existence at compile time. A call like [FIROptions trackingID] uses dynamic message dispatch, so the compiler has no way of knowing whether the method actually exists until it is invoked at runtime. As a result:
✅ Compilation — succeeds without any errors
✅ Application startup — works fine as long as that code path is not executed
❌ Runtime — the app crashes only when setUserId is called, because that's when [FIROptions trackingID] sends a message to a non-existent selector, resulting in an NSInvalidArgumentException.