title: Parsing RSS in Obj-C?
body: <p>I'm trying to parse RSS date to view in my app, following <a href="https://www.youtube.com/watch?v=9MEnvlqP-wU" rel="nofollow">this tutorial</a>. I have a JSON file to retrieve information from and display on the screen.</p>
  
  <p>Here's the code</p>
  
  <pre><code>//
  //  ViewController.m
  //  JSONyt
  //
  //  Created by yo_291 on 3/16/15.
  //  Copyright (c) 2015 yo_291. All rights reserved.
  //
  
  #import "ViewController.h"
  
  @interface ViewController ()
  
  {
      NSMutableData *webData;
      NSURLConnection *connection;
      NSMutableArray *array;
  }
  
  @end
  
  @implementation ViewController
  
  
  
  - (void)viewDidLoad {
  
      [[self myView]setDelegate:self];
  
      [[self myView]setDataSource:self];
  
      array = [[NSMutableArray alloc]init];
  
  
  
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  
  -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
  {
      [webData setLength:0];
  }
  
  -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
  {
      [webData appendData:data];
  }
  
  -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
  {
      NSLog(@"fail with error");
  }
  
  -(void)connectionDidFinishLoading:(NSURLConnection *)connection
  
  {
      NSDictionary *allDataDictionary = [NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];
      NSDictionary *rd = [allDataDictionary objectForKey:@"responseData"];
      NSDictionary *feed = [rd objectForKey:@"feed"];
      NSArray *aoe = [feed objectForKey:@"entries"];
  
      for(NSDictionary *diction in aoe)
      {
          NSDictionary *numb = [diction objectForKey:@"0"];
          NSString *title = [numb objectForKey:@"title"];
  
  
          [array addObject:title];
  
          }
  
      [[self myView] reloadData];
  
  
  }
  
  
  - (IBAction)getFeed:(id)sender {
  
      NSURL *url = [NSURL URLWithString:@"http://ajax.googleapis.com/ajax/services/feed/load?v=2.0&amp;q=http://www.britannica.com/feeds/tdih.rss&amp;num="];
      NSURLRequest *request = [NSURLRequest requestWithURL:url];
  
      connection = [NSURLConnection connectionWithRequest:request delegate:self];
  
      if(connection)
      {
          webData = [[NSMutableData alloc]init];
  
      }
  
  
  }
  
  -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
      return 1;
  }
  
  -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      return [array count];
  }
  
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *cellI = @"Cell";
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellI];
  
      if(!cell)
      {
          cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellI];
      }
  
      cell.textLabel.text = [array objectAtIndex:indexPath.row];
  
      return cell;
  }
  
  
  @end
  </code></pre>
  
  <p>The application crashes on the line <code>[array addObject:title];</code>.</p>
  
  <p>Error Stack trace:</p>
  
  <pre><code>2015-03-16 22:32:51.650 JSONyt[8195:547408] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
  *** First throw call stack:
  (
      0   CoreFoundation                      0x000000010ba28a75 __exceptionPreprocess + 165
      1   libobjc.A.dylib                     0x000000010b6c1bb7 objc_exception_throw + 45
      2   CoreFoundation                      0x000000010b8f70ca -[__NSArrayM insertObject:atIndex:] + 954
      3   JSONyt                              0x000000010b18da5f -[ViewController connectionDidFinishLoading:] + 735
      4   CFNetwork                           0x000000010d85998c __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 69
      5   CFNetwork                           0x000000010d859930 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
      6   CFNetwork                           0x000000010d859a97 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
      7   CFNetwork                           0x000000010d729937 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 107
      8   CFNetwork                           0x000000010d7f6a31 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 273
      9   CFNetwork                           0x000000010d714d16 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 72
      10  CoreFoundation                      0x000000010b930b44 CFArrayApplyFunction + 68
      11  CFNetwork                           0x000000010d714bd7 _ZN19RunloopBlockContext7performEv + 133
      12  CFNetwork                           0x000000010d714a16 _ZN17MultiplexerSource7performEv + 256
      13  CFNetwork                           0x000000010d71482c _ZN17MultiplexerSource8_performEPv + 72
      14  CoreFoundation                      0x000000010b95dc91 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
      15  CoreFoundation                      0x000000010b953b5d __CFRunLoopDoSources0 + 269
      16  CoreFoundation                      0x000000010b953194 __CFRunLoopRun + 868
      17  CoreFoundation                      0x000000010b952bc6 CFRunLoopRunSpecific + 470
      18  GraphicsServices                    0x000000010f005a58 GSEventRunModal + 161
      19  UIKit                               0x000000010be18580 UIApplicationMain + 1282
      20  JSONyt                              0x000000010b18e483 main + 115
      21  libdyld.dylib                       0x000000010dfd6145 start + 1
      22  ???                                 0x0000000000000001 0x0 + 1
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  </code></pre>
  
  <p>but I have no idea how to go about fixing it. To my eyes I'm searching the JSON file correctly but I may be wrong. The JSON file is also an RSS feed that I've used a google tool to "turn" into a JSON database, so I'm unsure if complications are from there. </p>
  
  <p>Let me know any/all information that is needed, this is my first post so I don't know if I'm delivering enough context.</p>