Migrate Adapty iOS SDK to v4.3
To update your app from Adapty iOS SDK 4.1 or 4.2 to 4.3, apply every change in this guide. An app on 4.0 needs the v4.1 changes first. To continue to 4.4, follow Migrate to v4.4 next.
Quick reference
| Before | After |
|---|---|
localizedPrice and currencyCode can be nil | Both properties always return a string |
No billingPlanUnavailable error code | AdaptyError.ErrorCode includes billingPlanUnavailable |
Adapty.reportTransaction with a bare Transaction | Adapty.reportTransaction with a VerificationResult<Transaction>; the Transaction overload is deprecated |
localizedPrice and currencyCode are no longer optional
In 4.3, the localizedPrice and currencyCode properties of AdaptyPaywallProduct and AdaptySubscriptionOffer always return a string, never nil. Code that checks them for nil with if let, guard let, or ?. doesn’t compile. Remove these checks:
- if let price = product.localizedPrice {
- priceLabel.text = price
- }
+ priceLabel.text = product.localizedPrice
Remove ?? default values on these properties too: they compile, but with a warning.
AdaptyError.ErrorCode includes billingPlanUnavailable
4.3 adds the billingPlanUnavailable error code. A switch statement that lists every error code, with no default branch, stops compiling. To fix it, add a case .billingPlanUnavailable branch or a default branch.
The Transaction overload of reportTransaction is deprecated
In 4.3.2, the Adapty.reportTransaction(_:withVariationId:) overload that takes a bare Transaction, with no App Store signature, yields a deprecation warning. To report the transaction with its App Store signature, pass the VerificationResult<Transaction> that StoreKit returns:
- try await Adapty.reportTransaction(transaction, withVariationId: variationId)
+ try await Adapty.reportTransaction(verificationResult, withVariationId: variationId)