How to remove a very old, defunct in-app purchase

2019-02-25 10:41发布

问题:

My company recently outsourced the development of an iOS app to a third-party developer. The app included a lot of in-app purchases, and the developer sent us various builds, many of which were pre-alpha and contained bugs. As a result, my phone (iPhone 4S) appears to have a lot of defunct in-app purchase attempts which cause it to keep popping up a request for a password many times a day.

The test account for the purchases has been deleted. The app has been removed from my phone.

Some googling around and looking on stackoverflow seems to suggest that there are some purchases stuck in a queue that keep attempting to finish whenever I use another app that has in-app purchases. However I have no idea how to clear this queue and remove these annoying popups.

Is there a foolproof method, or a short code extract I can use that will do this? I have access to Xcode and Xamarin Studio, and have moderate technical knowledge, although am not an expert in iOS development.

Thanks in advance.

回答1:

AFAIK, it's impossible to receive and handle transactions, which was sent to other applications.

Are you "sure" you deleted that app? Are you sure, that you are not using the app possibly with the other name, with the same bundleID, as the old app?

Edit: By Nande's suggestion, I'm adding code to the actual answer, so people can see it without need to check my link.

// take current payment queue
SKPaymentQueue* currentQueue = [SKPaymentQueue defaultQueue];
// finish ALL transactions in queue
[currentQueue.transactions enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
    [currentQueue finishTransaction:(SKPaymentTransaction *)obj];
}];