- (void) recordTransaction: (SKPaymentTransaction *) transaction {
NSDictionary * receipt = [transaction.transactionReceipt dictionaryFromAppleResponse];
NSDictionary * purchaseInfo = [[NSData dataFromBase64String: [receipt objectForKey: @"purchase-info"]] dictionaryFromAppleResponse];
NSURL * url = [NSURL URLWithString: @"http://..."];
ASIFormDataRequest * request = [ASIFormDataRequest requestWithURL: url];
[request setDelegate: self];
UIDevice * device = [UIDevice currentDevice];
NSString * userAgent = [NSString stringWithFormat: @"Model: %@ (%@); System: %@ %@; Name: %@; UDID: %@", device.model, device.localizedModel, device.systemName, device.systemVersion, device.name, device.uniqueIdentifier];
[request addRequestHeader: @"User-Agent" value: userAgent];
[request setPostValue: [NSNumber numberWithBool: YES] forKey: @"upload"];
[request setPostValue: [[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleDisplayName"] forKey: @"app_id"];
[request setPostValue: [receipt descriptionInStringsFileFormat] forKey: @"receipt"];
[request setPostValue: [purchaseInfo descriptionInStringsFileFormat] forKey: @"purchase_info"];
[WTFeedbackView switchToProgressView];
[request setUploadProgressDelegate: [WTFeedbackView class]];
NSLog(@"Before -startAsynchronous call.");
[request startAsynchronous];
NSLog(@"After -startAsynchronous call.");
}
NSData -dictionaryFromAppleResponse
returns an NSDictionary
. I can't figure out why I'm getting the following error:
Error Domain=ASIHTTPRequestErrorDomain Code=10 "NSInvalidArgumentException" UserInfo=0x19eb00 {NSLocalizedFailureReason=+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil, NSUnderlyingError=0x19eae0 "The operation couldn’t be completed. (ASIHTTPRequestErrorDomain error 10.)", NSLocalizedDescription=NSInvalidArgumentException}