我正在尝试使用以下代码访问实例对象的属性
for (User *user in likersArray)
{
//Set variables for dictionary
NSString *nameLength = [NSString stringWithFormat:@"%i",[user.nickname length]];
}
但是,我不断收到以下错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString nickname]: unrecognized selector sent to instance 0x8c0f780'
我的用户类定义如下
@interface User : NSObject <NSCoding>
{
NSString *uid;
NSString *name;
NSString *nickname;
}
@property (nonatomic, copy) NSString *uid;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *nickname;
@end