//如果是退出登录,那么就删除本地存储的数据,遍历NSUserDefaults里面的所有key,将不是所需key的其他全部删掉
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSDictionary* defaults = [defs dictionaryRepresentation];
for (id key in defaults) {
if (![key isEqualToString:@"所需要的不能删除key"]) {
[defs removeObjectForKey:key];
[defs synchronize];
} else {
NSLog(@"%@",[defs objectForKey:key]);
}
}