//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);
原文地址:http://blog.csdn.net/xyxjn/article/details/44853171