JSON GetData...
@property NSMutableURLRequest *urlRequestFree;
@property NSURLSessionConfiguration *urlSessionConfigurationFree;
@property NSURLSession *urlSessionFree;
@property NSURLSessionDataTask *dataTaskFree;
@property NSMutableDictionary *freeAppsData;
-(void) JsonPost {
self.urlRequestFree=[[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:@"https://itunes.apple.com/in/rss/topfreeapplications/limit=200/json"]];
self.urlSessionConfigurationFree=[NSURLSessionConfiguration defaultSessionConfiguration];
self.urlSessionFree=[NSURLSession sessionWithConfiguration:self.urlSessionConfigurationFree];
self.dataTaskFree=[self.urlSessionFree dataTaskWithRequest:self.urlRequestFree completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
self.freeAppsData=[NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@",self.freeAppsData);
}];
[self.dataTaskFree resume];
}
ReplyDeleteNSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL: [NSURL URLWithString:[NSString stringWithFormat: @"https://itunes.apple.com/us/rss/topaudiobooks/limit=10/json"]]] options:kNilOptions error:&error];
for (int i=0; i<9; i++) {
NSLog(@"json: %@", [[[[[json objectForKey:@"feed" ]objectForKey:@"entry"]objectAtIndex:i]objectForKey:@"title"]objectForKey:@"label"]);
}
self.mutableArr =[[NSMutableArray alloc]init];
ReplyDeleteAFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager GET:@"https://itunes.apple.com/in/rss/topfreeebooks/limit=10/json" parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject)
{
NSLog(@"JSON: %@", responseObject);
for (int i=0; i<9; i++)
{
[self.mutableArr addObject:[[[[[responseObject objectForKey:@"feed" ]objectForKey:@"entry"]objectAtIndex:i]objectForKey:@"im:name"]objectForKey:@"label"]];
}
} failure:^(NSURLSessionTask *operation, NSError *error) {
NSLog(@"Error: %@", error);
}
];