mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
iOS: Don't resolve request ID 0 from the payment queue
updatedTransactions posted success/failure unconditionally, but StoreKit also delivers transactions we didn't initiate - unfinished ones at startup, for instance - when no request is pending. Request IDs start at 10, so that just produced "Unexpected request ID 0" errors. Guard it like the restore-finished handler already does. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JZk5y4Fzw811WJoNWZb8Sc
This commit is contained in:
1 parent
6548a4f5cf
commit
56affb3cb9
1 file changed
+9
-4
+9
-4
@@ -134,15 +134,20 @@
|
||||
// Perform the unlock (updaing the variable and switching the icon).
|
||||
[self unlockGold];
|
||||
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
|
||||
g_requestManager.PostSystemSuccess(_pendingRequestID, "", 0);
|
||||
_pendingRequestID = 0;
|
||||
// The queue also delivers transactions we didn't ask for, like unfinished ones at startup.
|
||||
if (_pendingRequestID != 0) {
|
||||
g_requestManager.PostSystemSuccess(_pendingRequestID, "", 0);
|
||||
_pendingRequestID = 0;
|
||||
}
|
||||
break;
|
||||
case SKPaymentTransactionStateFailed:
|
||||
NSLog(@"[IAPManager] Purchase failed (requestID: %d): %@", _pendingRequestID, transaction.error.localizedDescription);
|
||||
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
|
||||
// Optionally post failure callback here
|
||||
g_requestManager.PostSystemFailure(_pendingRequestID);
|
||||
_pendingRequestID = 0;
|
||||
if (_pendingRequestID != 0) {
|
||||
g_requestManager.PostSystemFailure(_pendingRequestID);
|
||||
_pendingRequestID = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user