In app purchase live url show sandbox popup and allow subscription for sandbox user
In app purchase live url show sandbox popup and allow subscription for sandbox user
I have added in-app purchase in my application it is working well in sandbox environment but when I change it's URL from sandbox to live and run the application it is behaving unexpectedly.
Here is my code:
Below are the method in which we are requesting to apple for getting in app purchase detail of user.
-(BOOL) getSubscriptionStatusFromAppleWithReceipt:(NSData *) receiptData
{
NSError *error;
NSMutableDictionary *requestContents = [NSMutableDictionary dictionaryWithObject:
[receiptData base64EncodedStringWithOptions:0] forKey:@"receipt-data"];
NSString *sharedSecret = @“*********************”;
if (sharedSecret) requestContents[@"password"] = sharedSecret;
NSData *requestData = [NSJSONSerialization dataWithJSONObject:requestContents options:0 error:&error];
NSString *strUrl = @"";
// Live server
strUrl = @"https://buy.itunes.apple.com/verifyReceipt";
// Devlopment server
// strUrl = @"https://sandbox.itunes.apple.com/verifyReceipt";
NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:strUrl]];
[storeRequest setHTTPMethod:@"POST"];
[storeRequest setHTTPBody:requestData];
queue = [NSOperationQueue mainQueue];
// NSError *error = nil;
NSHTTPURLResponse *response = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:storeRequest returningResponse:&response error:&error];
if (!error)
{
NSString* newStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
if ([jsonResponse[@"latest_receipt_info"] isKindOfClass:[NSArray class]])
{
NSArray *receiptInfo = (NSArray *) jsonResponse[@"latest_receipt_info"];
return [self parseJsonFromAppleServer:receiptInfo];
}
}
else
{ NSLog(@"%@", error.localizedDescription);
}
return false;
}
And next method in this I m retrieving the last index of receipt array and try to get user's subscription details.
Should I upload it on test flight or any other way in it's differentiation from live to development?
How to test it in live environment.
Thanks
1 Answer
1
App should be code-singed with production provisioning profile in order to run IAP with Live server. I think that you can only test with production servers using test flight since app have to be signed by Apple servers.
You don't have to go through beta review if you are going to test with internal tester accounts.
– najdanovicivan
1 hour ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
"app have to be signed by Apple servers." means do we submit it for beta app review then we can test it?
– Chandni
yesterday