- (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}发布于 2010-09-16 09:15:54
如果您在objc_exception_throw上添加了断点,这将帮助您获得更多关于错误位置的信息(如果您这样做了,请务必将回溯添加到您的问题中)。
假设错误来自ASIHTTPRequest本身,它使用NSInvocation与它的委托对话。我对您的代码中的这一行表示怀疑:
[request setUploadProgressDelegate: [WTFeedbackView class]];我不确定您是否可以将进度委托设置为一个类,我一直认为它必须是一个实际的对象-也许可以尝试删除它,我怀疑它会使错误消失。
https://stackoverflow.com/questions/3722988
复制相似问题