开发者

Not getting the data from nspropertylistserialisation

开发者 https://www.devze.com 2023-01-22 16:53 出处:网络
Not getting the data to the array variable NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消