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 に答える