title: Removing objects from array in NSUserDefaults
body: <p>When setting <code>NSUserDefaults</code>, I was initially using this code to set the defaults...</p>
  
  <pre><code> NSMutableArray *array = [NSMutableArray arrayWithObjects: @"string1", @"string2", @"string3", nil];
   [[NSUserDefaults standardUserDefaults] setObject:array forKey: @"preset1"];
   [[NSUserDefaults standardUserDefaults] synchronize];
  </code></pre>
  
  <p>I've learned that I should be using this instead:</p>
  
  <pre><code>NSMutableArray *array = [NSMutableArray arrayWithObjects: @"string1", @"string2", @"string3", nil];
  NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:array forKey:@"preset1"];
  [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
  </code></pre>
  
  <p>Now I'm having an issue manipulating the objects later on in <code>array</code>. Here is the code I use to add/remove strings from <code>array</code>. It worked fine when I was initially setting the defaults manually in my first example. Now, the objects will not remove from the array. I did notice when printing the array in LLDB debugger that <code>array</code> is now being stored as a <code>NSCFArray</code> when it was just an <code>NSArray</code> before.</p>
  
  <pre><code>NSMutableArray *array = [[NSMutableArray alloc] init];
  [array addObjectsFromArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"preset1"]];
  
  NSArray *stringsToRemove = @[@"string1", @"string2" ]; 
  
  for (NSUInteger i = 0; i &lt; stringsToRemove.count; i++) {
      [array removeObjectIdenticalTo:[stringsToRemove objectAtIndex:i]];
  }
  
  [[NSUserDefaults standardUserDefaults] setObject:array forKey: @"preset1"];
  [[NSUserDefaults standardUserDefaults] synchronize];  
  </code></pre>