snowplow / snowplow-ios-tracker

Snowplow event tracker for Swift and Objective-C. Add analytics to your iOS, macOS, tvOS and watchOS apps and games
http://snowplow.io
Apache License 2.0
80 stars 92 forks source link

Crash when caching remote config with logger #900

Closed JasminFrei closed 1 week ago

JasminFrei commented 1 week ago

Describe the bug When a new remote configuration with a version higher than the current default configuration is available, the SDK crashes on app start. Our investigation showed that the bug lies in the combination of having a default configuration with a loggerDelegate and fetching a newer remote config. The crash happens when the SDK tries to write the configuration to the cache.

Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', 
reason: 'This decoder will only decode classes that adopt NSSecureCoding. 
Class '[Our LoggerDelegate class]' does not adopt it.'.

To Reproduce

Expected behavior

  1. No crash - The SDK should not crash our app but just log an error, caching is no crucial functionality.
  2. After carefully looking at the problem we would expect the logger to not be part of a default configuration but to be something we can put on any tracker at any time. Or just put it somewhere where you don't try to cache it. Our logger does contain classes that are initialized at runtime, there is no way this class could be serialized.

Device information (please complete the following information):

Additional context We backtraced the bug to be added in v5.3 of the iOS tracker library. We did not find it earlier because we never needed to upgrade our remote configuration until this week. (I'll add a detailed stacktrace in a support ticket and give more information of the impact on our app there)

matus-tomlein commented 1 week ago

Hi @JasminFrei, thank you for reporting this bug, we will look into this shortly. Please do share the stack trace with us in the support ticket, that would be helpful as well.