[X] This issue is not security related and can safely be disclosed publicly on GitHub
Xcode version
15.2
Facebook iOS SDK version
16.3.1
Dependency Manager
SPM
SDK Framework
Core
Goals
The code in our app defines a tracking function that takes one generic argument of RawRepresentable and constraints it to Swift's String type.
func trackEvent<E: RawRepresentable>(name: E) where E.RawValue == String { }
When we try to pass it AppEvents.Name like so, the app crashes.
let event = AppEvents.Name("Exclude Exercises Did Load")
trackEvent(name: event)
Please note that although the sample above calls trackEvent in the same context the crash does not happen when the trackEvent is called (it could be delayed and the crash would still happen even before the call).
Expected results
Either a compiler warning that passing AppEvents.Name to the above function isn't safe or better error handling in the SDK.
Checklist before submitting a bug report
Xcode version
15.2
Facebook iOS SDK version
16.3.1
Dependency Manager
SPM
SDK Framework
Core
Goals
The code in our app defines a tracking function that takes one generic argument of
RawRepresentable
and constraints it to Swift'sString
type.When we try to pass it
AppEvents.Name
like so, the app crashes.Please note that although the sample above calls
trackEvent
in the same context the crash does not happen when thetrackEvent
is called (it could be delayed and the crash would still happen even before the call).Expected results
Either a compiler warning that passing
AppEvents.Name
to the above function isn't safe or better error handling in the SDK.Actual results
Stack trace:
The crash can be fixed by introducing an additional
trackEvent
function which is scoped to theAppEvents.Name
type like soSteps to reproduce
A sample app demonstrating the crash can be found at https://github.com/dusi/FacebookCrashSampleApp
Code samples & details