首页 > 移动平台 > 详细

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

时间:2015-04-03 13:31:57      阅读:273      评论:0      收藏:0      [点我收藏+]


    //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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!