0
- (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}
4

1 回答 1

0

如果您在 objc_exception_throw 上添加断点,那应该可以帮助您获得更多关于哪里出错的信息(如果您这样做,请务必将回溯添加到您的问题中)。

假设错误来自 ASIHTTPRequest 本身,它使用 NSInvocation 与它的委托对话。我怀疑您的代码中的这一行:

[request setUploadProgressDelegate: [WTFeedbackView class]];

我不确定您是否可以将进度委托设置为一个类,我一直认为它必须是一个实际的对象 - 也许尝试删除它,我怀疑它会使错误消失。

于 2010-09-16T01:15:53.860 回答