Guest User

Untitled

a guest
Jul 11th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
  2.  
  3. //---initialize the array---
  4. listOfJMovies = [[NSMutableArray alloc] init];
  5. listOfJMoviePosters = [[NSMutableArray alloc] init];
  6. tmdbMovies = [[NSArray alloc] init];
  7. posters = [[NSArray alloc] init];
  8. thumbs = [[NSArray alloc] init];
  9.  
  10. //---set the title---
  11. self.navigationItem.title = @"Movies";
  12.  
  13. NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
  14.  
  15. //NSLog(responseString);
  16.  
  17. SBJsonParser *json = [[SBJsonParser new] autorelease];
  18. tmdbMovies = [json objectWithString:responseString error:nil];
  19.  
  20. for (id movie in tmdbMovies) {
  21. [listOfJMovies addObject:[movie objectForKey:@"name"]];
  22. NSLog(@"Name: %@", [movie objectForKey:@"name"]);
  23. //[listOfJMoviePosters addObject:[obj objectForKey:@"posters"]];
  24. //NSLog(@"%@", [obj objectForKey:@"posters"]);
  25.  
  26. posters = [movie objectForKey:@"posters"];
  27.  
  28. for (id image in posters) {
  29. NSLog(@"image: %@", [image objectForKey:@"image"]);
  30. thumbs = [image objectForKey:@"image"];
  31.  
  32. for (id url in thumbs) {
  33.  
  34.  
  35. NSLog(@"Size: %@", [url objectForKey:@"size"]);
  36.  
  37. //NSLog(@"blah");
  38. //[listOfJMoviePosters addObject:[url objectForKey:@"size"]];
  39.  
  40. }
  41.  
  42.  
  43.  
  44. }
  45.  
  46. }
  47.  
  48.  
  49. [[self tableView] reloadData];
  50.  
  51. [responseString release];
  52. [connection release];
  53. [responseData release];
  54.  
  55.  
  56. }
  57.  
  58. for (id image in posters) {
  59. NSLog(@"image: %@", [image objectForKey:@"image"]);
  60. thumbs = [image objectForKey:@"image"];
  61.  
  62.  
  63. NSLog(@"Size: %@", [thumbs objectForKey:@"size"]);
  64.  
  65. }
  66.  
  67. for (NSDictionary *image in posters) {
  68. NSLog(@"image: %@", [image objectForKey:@"image"]);
  69. thumbs = [image objectForKey:@"image"];
  70.  
  71. for (NSString *url in thumbs) {
  72. NSLog(@"Size: %@", [url length]);
  73.  
  74. //NSLog(@"blah");
  75. //[listOfJMoviePosters addObject:[url objectForKey:@"size"]];
  76.  
  77. }
  78. }
Add Comment
Please, Sign In to add comment