我想将对象添加到 nsdictionary 并访问这些对象或修改对象中的属性,但我无法获取它们。
例如:
ObjectClass:
-(id)init
{
self = [super init];
if (self)
{
self.firstName = @"";
self.lastName = @"";
}
return self;
}
mainClass:
ObjectClass *myObject = [ObjectClass allo] init];
NSMutableDictionary *listOfClients = [NSMutableDictionary allo] init];
[self.listOfClients setObject:myObject forKey:@"firstClient"];
(lldb) po [listOfClients valueForKey:@"firstClient"]
$5 = 0x0683e140 <myObject: 0x683e140>
(lldb) po [_testDic valueForKey:@"firstClient.myObject"]
$6 = 0x00000000 <nil>
例如,如何访问 firstClient 的 firstName?
我真的很感谢你的帮助