当我调用此函数时,我的应用程序崩溃了。
我收到了这个错误:[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1].
如果你知道,我该如何解决它请帮忙。
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSDictionary *dict = [defs dictionaryRepresentation];
for (id key in dict)
{
NSObject * object = [dict objectForKey:key];
if(object != nil)
{
[defs removeObjectForKey:key];
[defs synchronize];
}
}