Not getting the data from nspropertylistserialisation
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];
Anyone help me to solve this?
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.
精彩评论