title: NSDictionary removing null values. Created from a JSON feed
body: <p>I have null values in a couple of arrays within my NSDictionaries so I am trying to run through them and remove all the null values. Here is my attempt. </p>
  
  <pre><code>    dict = [dict dictionaryByReplacingNullsWithStrings];
      NSMutableDictionary *mdict = [dict mutableCopy];
      NSArray *clubs = [dict objectForKey:@"clubs"];
      NSArray *badges = [dict objectForKey:@"badges"];
      NSMutableArray *newBadges = [badges mutableCopy];
      NSMutableArray *newClubs = [clubs mutableCopy];
  
  
      for(int i = 0; i &lt; [clubs count]-1; i++){
          NSDictionary *theclub = [clubs objectAtIndex:i];
          theclub = [theclub dictionaryByReplacingNullsWithStrings];
          newClubs = [newClubs addObject:theclub];
      }
  
  
      for(int i = 0; i &lt; [badges count]-1; i++){
          NSDictionary *thebadge = [clubs objectAtIndex:i];
          thebadge = [thebadge dictionaryByReplacingNullsWithStrings];
          newBadges = [newBadges addObject:thebadge];
      }
      [mdict removeObjectForKey:@"badges"];
      [mdict removeObjectForKey:@"clubs"];
  
      NSLog(@"new Badges %@", newBadges);
  
      [mdict setObject:newBadges forKey:@"badges"];
      [mdict setObject:newClubs forKey:@"clubs"];
  </code></pre>
  
  <p>the problem is that  I get an error on the 2 lines in the code:</p>
  
  <pre><code>    newClubs = [newClubs addObject:theclub];
  </code></pre>
  
  <p>and the line</p>
  
  <pre><code>     newBadges = [newBadges addObject:thebadge];
  </code></pre>
  
  <p>both within the two for loops. </p>
  
  <p>the error is as follows:</p>
  
  <pre><code>**Assigning to 'NSMutableArray* __strong' from incompatible type void.** 
  </code></pre>
  
  <p>The JSON feed I am creating this NSDictionary from is as follows: </p>
  
  <pre><code>{
  "id":249,
  "email":"email@gmail.com",
  "full_name":"Some one",
  "statement":"Lets kick some robot but. ",
  "avatar_url":"http://www.somesite.com/logo.png",
  "clubs":
      [{"id":31,"name":"Nintendo Games Club","logo_url":"http://www.somesite.com/logo.png","role_in_club":"Admin","level":{"id":23,"name":"Handicap","position":1,"image_url":"http://www.somesite.com/logo.png","code":"","weeks_to_achieve":1,"times_to_achieve":1,"club_type":{"id":13,"type_name":"Golf","token_criteria":false}}}],
  
  "badges":
     [{"id":29,"name":"Nearest the pin","description":"","image_url":"http://www.somesite.com/logo.png","club_id":null},{"id":28,"name":"Longest Drive","description":"","image_url":"http://www.somesite.com/logo.png","club_id":null}]
  
  }
  </code></pre>