Using this code that is officially handed by Apple in their documentation :
extension SKProductDiscount {
var localizedPrice: String {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.locale = self.priceLocale // Line #15 - this is where it crashes
return formatter.string(from: self.price) ?? ""
}
}
I have users crashing and according to Crashlytics, this is the stack trace:
What surprises me is that everything in this code is just StoreKit. I have tried changing to different locales, but I can't find how to make this crash happen.
FYI, it happens to a product that has a free introductory offer. So the formatted output string is "[€,$,etc]0.00".
What is this static Locale._unconditionallyBridgeFromObjectiveC(_:)
causing the crash?
This is an Apple bug which was fixed in iOS 12. The only choice for iOS 11 is to not rely on this dynamic localization but on some homemade logic...