NSString *str = @"{\"data\":[\"one\",\"two\",\"three\"],\"name\":null}";
NSDictionary *dic = [self dictionaryWithJsonString:str];[图片上传中...(截屏2023-02-21 18.29.30.png-c57209-1676975374657-0)]
// NSLog(@"%@", dic);
[[NSUserDefaults standardUserDefaults] setObject:dic forKey:@"123"];
// NSLog(@"%@", [self dictionaryToJson:dic]);
字典中存在null.使用UserDefault会崩溃, 要注意服务端的随时袭击,存json字符串和data可以
截屏2023-02-21 18.35.31.png
网友评论