我已将JSON
数据存储创建到propertylist
,其工作得非常好。今天下面的代码不是来自JSON
的所有数据,但问题是数据没有存储任何内容,显示空值。
我的代码:
NSArray *paths_watch = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = paths_watch.firstObject;
NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"newplist.plist"];
NSError *writeError = nil;
NSDictionary *finalDict = @{@"Objects": objects};
//Here I am not getting data below line
NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:finalDict format:NSPropertyListXMLFormat_v1_0 options:NSPropertyListImmutable error:&writeError];
NSLog(@"DATA FOR PLIST : %@",plistData);
if(plistData) {
[plistData writeToFile:plistPath atomically:YES];
} else {
NSLog(@"Error in saveData: %@", error);
}
面对以下错误:
Error Domain=NSCocoaErrorDomain Code=3851 "Property list invalid for format: 100 (property lists cannot contain objects of type 'CFNull')" UserInfo={NSDebugDescription=Property list invalid for format: 100 (property lists cannot contain objects of type 'CFNull')}