Why NSMutableDictionary don't want write to file?

前端 未结 2 1861
遥遥无期
遥遥无期 2020-12-18 09:59
- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([[NSFileManager defaultManager] fileExistsAtPath:pathString]) 
    {
        infoDict = [[NSMutableDictionary          


        
2条回答
  •  一向
    一向 (楼主)
    2020-12-18 10:10

    writeToFile:atomically only works if the dictionary you call it on is a valid property list object (see docs).

    For a NSDictionary to be a valid property list object, among other things, its keys must be strings, but in your example the keys are NSNumber instances.

提交回复
热议问题