title: How to Save NSMutableArray into plist in iphone
body: <p>I am new in iphone, i want to save NSMutableArray data into plist file my Code is:</p>
  
  <pre><code>NSArray *array = [[NSArray alloc] initWithArray:self.artistDetailsArray];
  [self.artistDetailsArray writeToFile:self.path atomically:YES];
  </code></pre>
  
  <p>but it shows 0 element in my plist path. please any help me.</p>
  
  <p>Thanks in advance:</p>
  
  <blockquote>
    <p>following is my code to store the data into plist and NSUserDefault.
    none of them is working for NSMutableArray/NSArray but working for NSString. IS there any max size limit to store in plist or UserDefault??
    NSMutableArray contains only text/ set of NSDictionary.</p>
  </blockquote>
  
  <p>please suggest me.</p>
  
  <pre><code>- (void)initialiseDataFromLocalStorage
  {
         NSFileManager *fileManager = [NSFileManager defaultManager];
         NSError *error;
         NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
         NSString *documentsDirectory = [paths objectAtIndex:0];
         self.path = [documentsDirectory stringByAppendingPathComponent:@"saveLogin.plist"];
         if ([fileManager fileExistsAtPath:self.path] == NO) {
                 NSString *pathToDefaultPlist = [[NSBundle mainBundle] pathForResource:@"saveLogin" ofType:@"plist"];
                 if ([fileManager copyItemAtPath:pathToDefaultPlist toPath:self.path error:&amp;error] == NO) {
                         NSAssert1(0,@"Failed with error '%@'.", [error localizedDescription]);
                 }
         }
  
     // To get stored value from .plist
         NSDictionary *dict = [[NSDictionary alloc]initWithContentsOfFile:self.path];
         self.ResumedataDictionary = [[NSMutableDictionary alloc]initWithDictionary:dict];
         [dict release];
     self.artistDetailsArray = [[NSMutableArray alloc] initWithArray:[self.ResumedataDictionary objectForKey:@"artistDetailsDict"]];    
     // To get stored value from NSUserDefault
     NSUserDefaults *fetchData = [NSUserDefaults standardUserDefaults];
     self.artistDetailsArray = [fetchData objectForKey:@"artistDetailsDict"];    
  }        
  
  -(void)saveDataToLocalStorage
  {    
     // To store value into .plist
     NSArray *array = [[NSArray alloc] initWithArray:self.artistDetailsArray];
     [ResumedataDictionary setObject:array forKey:@"artistDetailsDict"];
         [ResumedataDictionary writeToFile:self.path atomically:YES];  
  
     // To store value into NSUserDefault
     NSUserDefaults *fetchData = [NSUserDefaults standardUserDefaults];
     [fetchData setObject:self.artistDetailsArray forKey:@"artistDetailsDict"];    
  }
  </code></pre>