StoreKitPurchaseTracker
@available(iOS 3, tvOS 9, OSX 10.7, *)
@objc
open class StoreKitPurchaseTracker : NSObject, PurchaseTracker
A basic StoreKit In-App Purchase checker that uses only the payment queue and local storage to cache the list of purchase statuses. It does not validate receipts.
The local storage is unprotected if the user unlocks the device, and as such may be subject to relatively easy editing by the determined cheapskate user to unlock features.
Note
⚠️⚠️⚠️ Do not use this implementation if you insist on cryprographically verifying purchases.Note
⚠️⚠️⚠️ It is our view that we should rely on the security of Apple’s platform and not be overly concerned with users performing hacks and workarounds. People that go to the effort of jailbreaking, re-signing apps or applying other patching or data editing mechanisms are unlikely to have paid you any money anyway.If this isn’t good enough for you, you will need to add your own app-specific logic to verify this so there isn’t a single point of verification, and to check receipts. You may not want to use Flint for purchase verification at all if it transpires that the Swift call sites for conditional requests are easily circumvented.
Note
In-App Purchases APIs are not available on watchOS as of watchOS 5. Any Feature that requires a purchase will not be enabled on watchOS.-
Instantiate the StoreKit purchase tracker, storing the status of purchases in the container specified by
appGroupIndentifier
.- param appGroupIdentifier: If nil, the information about purchases will be stored in the app’s container. This will not be accessible to other parts of your app, e.g. app extensions. So if you have extensions you must create an app group container all extensions use and specify its identifier here.
Declaration
Swift
public init(appGroupIdentifier: String?) throws
-
Declaration
Swift
public func addObserver(_ observer: PurchaseTrackerObserver)
-
Declaration
Swift
public func removeObserver(_ observer: PurchaseTrackerObserver)
-
Called to see if a specific product has been purchased
Declaration
Swift
public func isPurchased(_ product: NonConsumableProduct) -> Bool?
-
Declaration
Swift
public func isSubscriptionActive(_ product: SubscriptionProduct) -> Bool?
-
Declaration
Swift
public func isFeatureEnabledByPastPurchases(_ feature: FeatureDefinition.Type) -> Bool
-
A naïve implementation that assumes all success and restores enable a purchase, and all failures and deferred remove them. This only works for one-time purchases
Declaration
Swift
public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])