字典与自定义对象的相互转换

字典  -> 自定义对象:

self setValuesForKeysWithDictionary:<#(nonnull NSDictionary<NSString *,id> *)#>

自定义对象  ->  字典:

    Person *p = [[Person alloc] init];

    p.name = @"小明";

    p.age = 20;

    

    NSDictionary *dict = [p dictionaryWithValuesForKeys:@[@"name",@"age"]];

    NSLog(@"%@",dict);

原文地址:https://www.cnblogs.com/panda1024/p/6285074.html