我有以下课程:
@interface Topics : NSObject {
NSNumber * _until_id;
NSArray * _topics;
}
@property (nonatomic, retain) NSNumber * until_id;
@property (nonatomic, retain) NSArray * topics;
@end
/////////////////////////////////////////////////////////////////////////
@class Login;
@interface Topic : NSObject {
NSString * _name;
Login * _creator;
NSNumber * _message_count;
NSNumber * _date_latest_message;
NSNumber * _date_created;
NSNumber * _tracked;
NSNumber * _unread;
NSNumber * _tid;
NSString * _kind;
NSNumber * _id;
}
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) Login * creator;
@property (nonatomic, retain) NSNumber * message_count;
@property (nonatomic, retain) NSNumber * date_latest_message;
@property (nonatomic, retain) NSNumber * date_created;
@property (nonatomic, retain) NSNumber * tracked;
@property (nonatomic, retain) NSString * kind;
@property (nonatomic, retain) NSNumber * unread;
@property (nonatomic, retain) NSNumber * tid;
@property (nonatomic, retain) NSNumber * gid;
@property (nonatomic, readonly) NSString* topicNavURL;
@end
现在我正在尝试使用以下方法访问特定主题名称:
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[TTTableTextItem class]];
[mapping mapKeyPath:@"topics.name" toAttribute:@"text"];
[mapping mapKeyPath:@"topics.topicNavURL" toAttribute:@"URL"];
但是,这失败了,因为它说它找不到名称,因为主题是 NSArray。如果我正在处理数组,有没有办法做 KVC?那么它只是NSString的吗?