The restore purchases option is the correct choice, and probably ought to be there in case the user deletes and reinstalls the application.
How to make IAP available on all devices?
-
15-10-2022 - |
سؤال
My app provides an in-app purchase to get some news alerts as push notifications. Push notifications should be delivered to all devices associated with the same Apple ID that is used to purchase.
Currently I thought of putting a button on the "settings" screen to restore in-app purchases to check if the feature is purchased in another device.
Is there any better way to handle this task? If so, any tips/suggestions would be highly appreciated!
المحلول
نصائح أخرى
You should use the restore purchase
feature:
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
It will restore all purchases that the user has made on that account, weather on the same ios device, or a different one.
Also, as a side note, if you implement In-app purchases
without including the restore
feature, your ios app will not be accepted by Apple
Or in iOS7, use SKReceiptRefreshRequest.
self.refreshRequest = [[SKReceiptRefreshRequest alloc] init];
self.refreshRequest.delegate = self;
[self.refreshRequest start];
Also note that this straightforward restore procedure doesn't necessarily work for all types of products. E.g., at least on iOS6, restoreCompletedTransactions will not restore non-renewable subscriptions. But the situation seems more complicated in iOS7 (see Non-renewing Subscriptions: Removed From Receipt?).