码迷,mamicode.com
首页 > 移动开发 > 详细

客户端自行连苹果服务器验证购买完成返回的receipt

时间:2015-04-03 13:34:17      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:receipt   苹果服务器   验证收据   


    //write your test code here
    NSError *error = nil;
    NSDictionary *requestContents  = @{@"receipt-data":[receipt base64EncodedStringWithOptions:0]
                                       ,@"password":@"29596c75453d49d4a8a46b7e89fff625"};
    
    NSData *requestData = [NSJSONSerialization dataWithJSONObject:requestContents options:0 error:&error];
    NSURL *storeURL = [NSURL URLWithString:@"https://buy.itunes.apple.com/verifyReceipt"];
#ifdef DEBUG
    storeURL = [NSURL URLWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"];
#endif
    NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:storeURL];
    [storeRequest setHTTPMethod:@"POST"];
    [storeRequest setHTTPBody:requestData];
    NSData * data1 =[NSURLConnection sendSynchronousRequest:storeRequest returningResponse:nil error:&error];
    NSDictionary* json1 = [NSJSONSerialization JSONObjectWithData:data1 options:NSJSONReadingMutableLeaves error:&error];
    NSLog(@"%@", json1);


客户端自行连苹果服务器验证购买完成返回的receipt

标签:receipt   苹果服务器   验证收据   

原文地址:http://blog.csdn.net/xyxjn/article/details/44853171

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!