tags:

views:

12

answers:

1

not getting the data to the array variable

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *path=[documentsDirectory stringByAppendingPathComponent:@"Employees.plist"];

NSData *datas = [NSData dataWithContentsOfFile:path];
NSString *err;
NSMutableArray *array = [NSPropertyListSerialization propertyListFromData:datas
                                                         mutabilityOption:NSPropertyListImmutable
                                                                   format:NSPropertyListXMLFormat_v1_0
                                                         errorDescription:&err];

any one help me to solve this

A: 

This should be throwing a compiler error. You're not supposed to pass a format value to the format arg. You're supposed to pass a pointer to a variable of type NSPropertyListFormat - this variable will be filled in with the actual format once the plist is deserialized. In any case, you're better off just using [NSArray arrayWithContentsOfFile:path] instead of using NSPropertyListSerialization.

Kevin Ballard