I have tried this code to copy my data to plist but its not working in the case of appending .can any one suggest me a good method for appending the data?
NSMutableDictionary *nameDictionary = [NSMutableDictionary dictionary];
NSString *plistPath=[[NSBundle mainBundle] pathForResource:@"listNew" ofType:@"plist"];
[nameDictionary setValue:nameEntered.text forKey:@"name"];
[nameDictionary setValue:company.text forKey:@"company"];
[nameDictionary setValue:designation.text forKey:@"designation"];
// create dictionary with values in UITextFields
NSMutableArray *plist = [NSMutableArray arrayWithContentsOfFile:plistPath];
if (plist == nil) plist = [NSMutableArray array];
[plist addObject:nameDictionary];
[plist writeToFile:plistPath atomically:YES];
UIAlertView *tellErr = [[UIAlertView alloc] initWithTitle:title message:@"succsefully created" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[tellErr show];
nameEntered.text=@"";
company.text=@"";
designation.text=@"";
You should use +[NSKeyedArchiver archiveRootObject:toFile:] to archive the Array object to file. And use +[NSKeyedUnarchiver unarchiveObjectWithFile:] to unarchive it.