If my apps user cancels a download, I don't want to corresponding purchase to succeed. Is there someway to tell StoreKit to cancel a purchase that is in progress so that it does not show the alert that says "purchase was successful"?
If by tapping "cancel" you mean The user taps on a cancel button inside your app, According to the SKPaymentQueue Class Ref, There is no way to cancel a purchase that has been set in motion.
But, the user can tap the cancel button on the Confirm Your In App Purchase screen, which you can handle to update your UI accordingly
Related
I've searched SO and the web and Apple's docs on in-app purchasing, and have not found an answer to this question. If I somehow missed the answer, my apologies.
I'm writing an iOS game that will have a single non-consumable in-app purchase to unlock the full game. The purchase and restore buttons are on a separate (settings) screen from the game screen. When the user makes a successful purchase, I set a flag in UserDefaults. Once that has happened, the purchase and restore buttons are unnecessary.
Is it ok to hide the purchase and restore buttons after a successful purchase so that they don't clutter up the settings screen? Or is that a violation of Apple's guidelines, or maybe just frowned upon?
It seems to me that there shouldn't be a problem with that. As long as my UserDefaults flag is true, I know that the purchase was made and the game should be unlocked, so there's no need for either the purchase or the restore button. And if, after making the purchase, the user deletes the app and reinstalls, my UserDefaults flag will be false so I will show the buttons and the user can hit the restore button in order to get the full game back.
Am I missing something?
I am presenting SKStoreReviewController.requestReview() and I want to have a boolean in UserDefaults which I would make true in case the user taps on Cancel.
Is there a way to determine if cancel was tapped considering this is a OS alert?
There isn’t a way to access which button was selected. I’m curious why you would you need this functionality? The OS will decide if the user should be shown the alert depending on a few factors including when the user last left a review or canceled.
Apple Developer Site:
https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview
Although you should call this method when it makes sense in the user
experience flow of your app, the actual display of a rating/review
request view is governed by App Store policy. Because this method may
or may not present an alert, it's not appropriate to call it in
response to a button tap or other user action.
I want to programmatically customize the "Authentication is disabled, try again in 1 minute" alert, that appears when I put the wrong passcode 5 times.
I don’t want to remove the blocked state, I only want to put another button in this alert and disable the existing cancel button.
The objective is to make a better callback, because when this alert is shown, and the users taps cancel, the callback is “UserCancel” and this is the same callback you get if the user taps the "Cancel" button before being blocked.
I want to determine which reason resulted in the cancellation of the passcode request.
It is possible to do this? If so, how?
If a push notification comes thru, and the user taps "close" (to ignore the notification) is the app told about the event?
No, it's a one way path, after the user press the close button, its gone forever.
The iOS Human Interface Guide says that on an iPad "Do not include a Cancel button when the action sheet is displayed without animation, because people can tap outside the popover to dismiss the action sheet without selecting one of the other alternatives". As a result, the Cancel button is not shown in these cases.
This is NOT intuitive. People are used to seeing a Cancel option whenever an action that can be cancelled is shown, and they may get confused if they don't see one. They may not realize that tapping outside the popver means Cancel.
The reasoning of "clicking outside the window to cancel" could have been used for PCs and Macs as well, but it isn't. A Cancel button is displayed in these systems.
I'm inclined to include an artificial Cancel button, but I'm afraid that this is against Apple HIG policy and my App will be rejected.
What do you think?
As someone who just encountered the same issue, I agree. It's not intuitive whatsoever!
As for Apple's recommendations
"Do not include a Cancel button when the action sheet is displayed without animation, because people can tap outside the popover to dismiss the action sheet without selecting one of the other alternatives." (p121)
"An animated action sheet should include a Cancel button, because people need to be able to dismiss the action sheet without closing the popover" (p121)
Will Apple reject your app if you don't follow these guidelines? This answer may offer some insight:
Will Apple reject my app if I do not do this?