У вас есть url
, это просто место получения чека, поэтому сначала вам нужно прочитать файл чека:
- (NSData *)loadReceipt
{
LogMethodCall
NSURL *url = NSBundle.mainBundle.appStoreReceiptURL;
if (!url) return nil;
NSError *error;
NSData *data = [NSData dataWithContentsOfURL:url options:0 error:&error];
if (data) return data;
NSLog(@"Error loading receipt data: %@", error.localizedDescription);
return nil;
}
Теперь у вас есть данные чека, которые вы можете преобразовать в NSDictionary
и просмотреть его содержимое:
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:[self loadReceipt]options:0 error:&error];
if (!error) {
NSLog(@"%@", json);
} else {
NSLog(@"%@", error);
}