NSString *str = self.completedDrills.drillId;
我只是设置字符串,但它给了我异常
NSInvalidArgumentException',原因:' - [__ NSCFDictionary drillTitle]:发送到实例的无法识别的选择器
这是我的Drill课程
#import <Foundation/Foundation.h>
#import "Category.h"
#import "Users.h"
#import "Benchmark.h"
@interface Drill : NSObject
@property (nonatomic, retain) NSString *drillId;
@property (nonatomic, retain) NSString *drillTitle;
@property (nonatomic, retain) NSString *crewName;
@property (nonatomic, retain) NSString *objectives;
@property (nonatomic, retain) Category *category;
@property (nonatomic, retain) NSMutableArray *benchmarks;
@property (nonatomic, retain) NSMutableArray *crewMembers;
@property (nonatomic, retain) Users *currentUser;
@property (nonatomic, retain) NSString *totalDrillTime;
@property (nonatomic, retain) NSString *timestamp;
@property (nonatomic, retain) NSString *error;
- (id)initWithCoder:(NSCoder *)coder;
- (void)encodeWithCoder:(NSCoder *)encoder;
@end
答案 0 :(得分:1)
self.completedDrills初始化错误。这样做:
self.completedDrills = [Drill new];
将Init方法添加到Drill.m:
- (id)init
{
self = [super init];
if (self) {
}
return self;
}