嗨,我正在尝试将 NSDictionary 写入文档文件夹中的 plist,但无法写入,我正在使用 writeToFile:atomically: 方法,该方法返回 False。完整的代码是
-(void)writeData:(NSDictionary *)dicResponseData
{
// get paths from root directory
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
// get documents path
NSString *documentsPath = [paths objectAtIndex:0];
// get the path to our Data/plist file
NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"Contractors.plist"];
[dicResponseData writeToFile:plistPath atomically: TRUE];
}
该词典包含 25 个子词典。