TelemetryDeck / SwiftSDK

Swift SDK for TelemetryDeck, a privacy-conscious analytics service for apps and websites.
https://telemetrydeck.com/
Other
148 stars 30 forks source link

EXC_BAD_ACCESS crash in iOS 16.4 simulator on call to TelemetryDeck.purchaseCompleted #158

Closed measuredweighed closed 6 days ago

measuredweighed commented 4 weeks ago

I'm seeing a reproducible crash when calling TelemetryDeck.purchaseCompleted in the iOS 16.4 simulator using version 2.1.1 of the TelemetryClient from SPM. Purchases appear to be logged correctly in iOS 17+. The crash seems to happen when calling StoreKit.Transaction's currencyCode getter. It appears there's been some recent work in this area that may be related.

EXC_BAD_ACCESS
Jeehut commented 3 weeks ago

@measuredweighed Do you know if this also happens on a real device?

measuredweighed commented 2 weeks ago

No, sorry, I didn't have a chance to run this on an actual iOS 16 device. I was evaluating TelemetryDeck and testing solely via the simulator/Xcode environment, which is how we tend to do the bulk of our In App Purchase testing before final device checks.

Jeehut commented 6 days ago

@measuredweighed Thank you for the extra info and sorry for the delay. I just returned from a trip to Cupertino for WWDC and this was the first task I picked up. Thanks to your aded information, I was able to reproduce the bug and fix it.

It seems that Apple forgot to keep the deprecated (but not removed!) APIs within the simulator, so I made sure to use the new APIs on devices where with newer OS (16.0 and newer). In my demo project this fixed the issue as it's no longer calling currencyCode. I'll be releasing version 2.2.1 of the SDK shortly with the fix. Please let me know if the issue still occurs.

See https://github.com/TelemetryDeck/SwiftSDK/pull/163 for details about the fix.