[使用AFNetworking目标c进行自动更新的应用内购买收据验证

问题描述 投票:1回答:2

我正在使用AFNetworking编写以下代码以进行收据验证,它的状态为210002虽然它在NSMutableURLRequest中为我提供status = 0

请帮助我获得解决方案

 NSString *strurl = @"https://sandbox.itunes.apple.com/verifyReceipt";   
 NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];

 NSDictionary *parameter=@{
                          @"receipt-data" : [receipt base64EncodedStringWithOptions:0],
                          @"password" : @"xxxxxxxxxxxxxxxxxxxx",
                         };


 NSData *jsonParam = [NSJSONSerialization dataWithJSONObject:parameter options:NSJSONWritingPrettyPrinted error:nil];

 AFHTTPRequestOperationManager *manager =  [AFHTTPRequestOperationManager manager];
 manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];
 [manager POST:strurl parameters:jsonParam success:^(AFHTTPRequestOperation *oprtation, id responseObject){
    NSLog(@"JSON: %@", responseObject);

 }failure:^(AFHTTPRequestOperation *operation, NSError *error){
    NSLog(@"Error: %@", error);

 }];

谢谢

我正在使用AFNetworking编写下面的代码以进行收据验证,它给我status = 210002,而在NSMutableURLRequest中给我status = 0,请通过获取解决方案NSString * ...

objective-c in-app-purchase ios9 afnetworking xcode7.2
2个回答
2
投票

这里是我在应用程序中使用的收据验证代码,但是我很快就实现了。


0
投票

以下是我在目标C中使用的iOS收据验证代码的摘要,以检查应用启动时的续订。这有助于我在应用启动时从App Store获取订阅续订收据数据。

© www.soinside.com 2019 - 2024. All rights reserved.