title: NSMutableArray in NSUserDefaults
body: <p>I'm sorry for my bad english but i'm trying to explain with best words.</p>
  
  <p>I have some problem when i'm trying to insert an NSMutableArray in NSUserDefaults (<code>[NSUserDefaults setObject:forKey:]</code>: Attempt to insert non-property value ')</p>
  
  <p>My code to insert the array is as follows: </p>
  
  <pre><code>-(void)saveToUserDefaults:(NSMutableArray*)myArray
  {
      NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
      NSArray *array = [[NSArray alloc ] initWithArray:myArray];
  
      if (standardUserDefaults) 
        {
             [standardUserDefaults setObject:array forKey:@"MyArray"];
             [standardUserDefaults synchronize];
        }
  
  }
  </code></pre>
  
  <p>My code to retrieve the array: </p>
  
  <pre><code>-(NSMutableArray*)retrieveFromUserDefaults
   {
       NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
       NSMutableArray *val = [[NSMutableArray alloc]init];
  
       if (standardUserDefaults) 
               val = [NSMutableArray arrayWithArray:[standardUserDefaults arrayForKey:@"MyArray"]];
  
       return val;
  </code></pre>
  
  <p>}</p>
  
  <p>and in my code : </p>
  
  <p>NSMutableArray : </p>
  
  <pre><code>  series = [[NSMutableArray alloc]initWithObjects:nil];
   //add some object inf my array...
  </code></pre>
  
  <p>Save my NSMutableArray : </p>
  
  <pre><code> [self saveToUserDefaults:series];
  </code></pre>
  
  <p>Retrieve my NSMutableArray : </p>
  
  <pre><code> series = [self retrieveFromUserDefaults];
  </code></pre>
  
  <p>I think it's not the best way to do this, so if anyone have ideas , it'll be helpful for me.</p>
  
  <p>Thanks for reading.</p>
  
  <p>Tommy</p>