OSX preferences file - removePersistentDomainForName has different functionality in 10.8?

独自空忆成欢 提交于 2019-12-23 03:31:44

问题


This code works for one of our developers on 10.7 but not for me on 10.8

working = it deletes the preferences .plist file for the bundle. The dev on 10.7 also has a lockfile whereas I do not. It's not a problem of file access - I tried [resetStandardUserDefault] and that made a new file, but that's not exactly we want to do.

NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];        
        [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];

I am having trouble locating any info about changes in 10.8 - does this sound familiar to anyone?


回答1:


I have the same issue and indeed there seems to be no info about any changes, also don't get any errors or warnings. [NSUserDefaults resetStandardUserDefault] doesn't do anything for me. What I do currently is simply overwrite the default values to reset them (give [[NSUserDefaults standardUserDefaults] setValuesForKeysWithDictionary: [NSDictionary dictionaryWithObjectsAndKeys:...]] the same input as originally given to [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:...]].

Not really an answer, but I don't have enough rep to comment..



来源:https://stackoverflow.com/questions/13595415/osx-preferences-file-removepersistentdomainforname-has-different-functionality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!