Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
- //---initialize the array---
- listOfJMovies = [[NSMutableArray alloc] init];
- listOfJMoviePosters = [[NSMutableArray alloc] init];
- tmdbMovies = [[NSArray alloc] init];
- posters = [[NSArray alloc] init];
- thumbs = [[NSArray alloc] init];
- //---set the title---
- self.navigationItem.title = @"Movies";
- NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
- //NSLog(responseString);
- SBJsonParser *json = [[SBJsonParser new] autorelease];
- tmdbMovies = [json objectWithString:responseString error:nil];
- for (id movie in tmdbMovies) {
- [listOfJMovies addObject:[movie objectForKey:@"name"]];
- NSLog(@"Name: %@", [movie objectForKey:@"name"]);
- //[listOfJMoviePosters addObject:[obj objectForKey:@"posters"]];
- //NSLog(@"%@", [obj objectForKey:@"posters"]);
- posters = [movie objectForKey:@"posters"];
- for (id image in posters) {
- NSLog(@"image: %@", [image objectForKey:@"image"]);
- thumbs = [image objectForKey:@"image"];
- for (id url in thumbs) {
- NSLog(@"Size: %@", [url objectForKey:@"size"]);
- //NSLog(@"blah");
- //[listOfJMoviePosters addObject:[url objectForKey:@"size"]];
- }
- }
- }
- [[self tableView] reloadData];
- [responseString release];
- [connection release];
- [responseData release];
- }
- for (id image in posters) {
- NSLog(@"image: %@", [image objectForKey:@"image"]);
- thumbs = [image objectForKey:@"image"];
- NSLog(@"Size: %@", [thumbs objectForKey:@"size"]);
- }
- for (NSDictionary *image in posters) {
- NSLog(@"image: %@", [image objectForKey:@"image"]);
- thumbs = [image objectForKey:@"image"];
- for (NSString *url in thumbs) {
- NSLog(@"Size: %@", [url length]);
- //NSLog(@"blah");
- //[listOfJMoviePosters addObject:[url objectForKey:@"size"]];
- }
- }
Add Comment
Please, Sign In to add comment