We are using Introductory Prices on our app. And we have an issue only reproducible on one of our two QA devices which is an iPhone 6S (11.4.1) on the French App Store. The other is an iPhone 7 (12.0 with French App Store) and the app is not crashing.
We are using this extension based on the SKProduct extension provided by SwiftyStoreKit :
@available(iOS 11.2, *)
public extension SKProductDiscount {
public var localizedPrice: String? {
return priceFormatter(locale: priceLocale).string(from: price)
}
private func priceFormatter(locale: Locale) -> NumberFormatter {
let formatter = NumberFormatter()
formatter.locale = locale
formatter.numberStyle = .currency
return formatter
}
}
Used like this :
func updateWith(storeProducts: Set<SKProduct>) {
guard
let selfStoreInfo = storeProducts.filter({ $0.productIdentifier == self.id }).first else {
Logger.warn(message: "Subscription \(self.id) not found on store", .inAppPurchase)
return
}
if #available(iOS 11.2, *) {
if let promo = selfStoreInfo.introductoryPrice {
promotionId = selfStoreInfo.productIdentifier
price = promo.localizedPrice
originalPrice = selfStoreInfo.localizedPrice
} else {
price = selfStoreInfo.localizedPrice
}
} else {
price = selfStoreInfo.localizedPrice
}
}
When debugging we found that priceLocale is responsible for throwing the EXC_BREAKPOINT
.
EDIT Could be linked to this : https://bugs.swift.org/browse/SR-7922?attachmentOrder=desc but it's strange that it would work on our iPhone 7 and not on the iPhone 6s