- (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];
[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
会返回NSDictionary
。我无法弄清楚为什么我收到以下错误:
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}
答案 0 :(得分:0)
如果你在objc_exception_throw上添加一个断点,那么这应该可以帮助你获得更多关于它出错的确切位置的信息(如果你这样做的话,你可以在你的问题中添加回溯)。
假设错误来自ASIHTTPRequest本身,它使用NSInvocation与其委托进行通信。我对你的代码中的这一行表示怀疑:
[request setUploadProgressDelegate: [WTFeedbackView class]];
我不确定你是否可以将进度委托设置为一个类,我总是假设它必须是一个实际的对象 - 也许尝试删除它,我怀疑它会使错误消失。