0
NSString *str = self.completedDrills.drillId;

我只是在设置字符串,但它给了我例外

NSInvalidArgumentException',原因:'-[__NSCFDictionary DrillTitle]:无法识别的选择器发送到实例

这是我的钻课

#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
4

1 回答 1

1

self.completedDrills 初始化不正确。做这个:

self.completedDrills = [Drill new];

并将 Init 方法添加到 Drill.m:

- (id)init
{
    self = [super init];
    if (self) {

    }
    return self;
}
于 2013-03-15T08:20:35.230 回答