Created
November 24, 2013 14:14
-
-
Save a2/7627720 to your computer and use it in GitHub Desktop.
SKHandleInvalidReceiptRequest & SKTerminateForInvalidReceipt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import StoreKit; | |
@interface SKHandleInvalidReceiptRequest : SKRequest | |
- (void)_sendXPCMessage; | |
@end | |
extern void SKTerminateForInvalidReceipt(void); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "StoreKit.h" | |
@interface SKRequest () | |
- (void)_startWithMessage:(xpc_object_t)message replyBlock:(dispatch_block_t)replyBlock; | |
- (void)_shutdownRequest; | |
@end | |
@implementation SKHandleInvalidReceiptRequest | |
- (void)_sendXPCMessage | |
{ | |
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0); | |
xpc_dictionary_set_int64(message, "0", 0x271c); | |
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); | |
[self _startWithMessage:message replyBlock:^{ | |
dispatch_semaphore_signal(semaphore); | |
}]; | |
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); | |
dispatch_release(semaphore); | |
xpc_release(dict); | |
[self _shutdownRequest]; | |
} | |
@end | |
void SKTerminateForInvalidReceipt(void) { | |
SKHandleInvalidReceiptRequest *request = [[SKHandleInvalidReceiptRequest alloc] init]; | |
[request start]; | |
[request release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment