storekit

IAPs are being restoring when they have not yet been purchased yet

☆樱花仙子☆ 提交于 2019-12-02 11:02:22
When the user calls restorePurchases(), the non-consumable com.premium is restored even thought they do not own it. Here are the functions that are responsible for the restoring purchases and purchasing IAPs. This is only an issue with non-consumable IAPs. There is no issue with purchasing. And if the user attempts to purchase an IAP that they already have, it is simply restored. Thank you for looking in to this. func restorePurchases() { SKPaymentQueue.default().add(self) SKPaymentQueue.default().restoreCompletedTransactions() } func paymentQueueRestoreCompletedTransactionsFinished(_ queue:

Best practice to add a transaction queue observer at application launch for Storekit

荒凉一梦 提交于 2019-12-02 10:16:17
I am having trouble trying to follow Apple's recommendation of adding a transaction queue observer in didFinishLaunchingWithOptions . Specifically I am trying to adapt code from a Ray Wenderlich tutorial which does not do this - it adds the observer only once the 'buy' button is tapped. My app crashes when the buyProduct function is called: public func buyProduct(_ product: SKProduct) { print("Buying \(product.productIdentifier)...") let payment = SKPayment(product: product) SKPaymentQueue.default().add(payment) } In my log I can see that the init of IAPHelper is called twice, thus calling

StoreKIt verification error: 21002

人走茶凉 提交于 2019-12-02 02:18:46
On a iPhone 4/iOS 4 device, sandbox App Store is reporting this error during verification. 21002: The data in the receipt-data property was malformed. On a iPhone 5/iOS 6 device, the same code works (status == 0, receipt returned) without any problems. I've restarted the device, made sure the Apple ID is logged out, even made a new test user account. Same result. Any ideas? This Error means the JSON Object that you have created to send for verification is not in correct format. { "receipt-data" : "(receipt bytes here)" } So My suggestion is to Debug the same on iPhone 4/iOS 4. In case, you are

How to get the original_application_version (the first purchased version number) out of iOS Receipt in iOS 11?

帅比萌擦擦* 提交于 2019-12-01 15:45:52
问题 I have a paid iOS App. I need to get the original_application_version number (the first version purchased by the user) from the Apple AppStore Receipt. To get the receipt, when my app loads, I use checkReceiptFromAppStore() function: func checkReceiptFromAppStore() { let receipt = self.getReceipt() print("receipt Data is: \(receipt)") // prints this: receipt Data is: Optional(5141 bytes) } getReceipt() function is the following: func getReceipt() -> Data? { if Bundle.main.appStoreReceiptURL !

Restore InApp purchase using swift, iOS

走远了吗. 提交于 2019-12-01 04:00:56
I am implementing restore in app purchase. I have a button whose action is @IBAction func restorePurchases(send : AnyObject){ SKPaymentQueue.defaultQueue().restoreCompletedTransactions() // if (success) { // I want to do something here // } } My question is. Is this the right way to restore? How can we verify success action for restoring purchases? Florian don't forget to check if you can make a payment: if (SKPaymentQueue.canMakePayments()) { SKPaymentQueue.default().restoreCompletedTransactions() } for check if the restore was good you have to follow the protocol:

iOS StoreKit - When to call - (void)restoreCompletedTransactions?

混江龙づ霸主 提交于 2019-12-01 03:50:42
I have lots of 1 time purchase IAPs inside of my application. Users can purchase them just fine. My problem is that I am integrating with Flurry to track real purchases versus just a restoration of a purchase, but my SKPaymentTransaction 's transactionState always comes back as SKPaymentTransactionStatePurchased rather than SKPaymentTransactionStateRestored . Apparently SKPaymentTransactionStateRestored is only called when - (void)restoreCompletedTransactions , but when do I call this method? My thought process is that a purchase should go like this: 1) User selects product, 2) User is asked

Restore InApp purchase using swift, iOS

青春壹個敷衍的年華 提交于 2019-12-01 00:29:13
问题 I am implementing restore in app purchase. I have a button whose action is @IBAction func restorePurchases(send : AnyObject){ SKPaymentQueue.defaultQueue().restoreCompletedTransactions() // if (success) { // I want to do something here // } } My question is. Is this the right way to restore? How can we verify success action for restoring purchases? 回答1: don't forget to check if you can make a payment: if (SKPaymentQueue.canMakePayments()) { SKPaymentQueue.default()

How to find out WHEN a user bought the app / installed it for the first time (possible without UDID?)

三世轮回 提交于 2019-11-30 20:22:41
I would like to find out when a user first bought my app... so far, I havent found a clean way and a UDID seemed to be the only option. Ideally there would be a receipt I can get via StoreKit but so far.. nada have I missed something ? Does anybody have an idea? The situation is that I have a subscription and the FIRST issue (from the time you buy the app should be free). If I reinstall at a later time.. I should always get the original issue) example: I buy the app in 10.2010 I install and run it and get the subscription issue from 10.2010 for free (no in-app purchase) Now I delete the app I

Use of unresolved identifier when using StoreKit constants with iOS 9.3/Xcode 7.3

点点圈 提交于 2019-11-30 20:18:15
I get the error "Use of unresolved identifier" when trying to use one of these StoreKit constants: SKErrorClientInvalid SKErrorPaymentCancelled SKErrorPaymentInvalid SKErrorPaymentNotAllowed SKErrorStoreProductNotAvailable SKErrorUnknown Your code may look like this: if transaction.error!.code == SKErrorPaymentCancelled { print("Transaction Cancelled: \(transaction.error!.localizedDescription)") } What changed? Is there a new module I need to import? As of iOS 9.3 certain StoreKit constants have been removed from the SDK. See StoreKit Changes for Swift for the full list of changes. These

Use of unresolved identifier when using StoreKit constants with iOS 9.3/Xcode 7.3

☆樱花仙子☆ 提交于 2019-11-30 16:55:39
问题 I get the error "Use of unresolved identifier" when trying to use one of these StoreKit constants: SKErrorClientInvalid SKErrorPaymentCancelled SKErrorPaymentInvalid SKErrorPaymentNotAllowed SKErrorStoreProductNotAvailable SKErrorUnknown Your code may look like this: if transaction.error!.code == SKErrorPaymentCancelled { print("Transaction Cancelled: \(transaction.error!.localizedDescription)") } What changed? Is there a new module I need to import? 回答1: As of iOS 9.3 certain StoreKit