我已经创建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')}