JSON
にデータストアを作成しましたpropertylist
が、非常にうまく機能しました。今日、以下のコードはすべてのデータが機能してJSON
いませんが、問題はデータが何も保存されておらず、null 値が表示されていることです。
私のコード:
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')}