2013-03-12 40 views
0
NSString *str = self.completedDrills.drillId; 

我只是設置字符串,但它給我的異常NSInvalidArgumentException iphone

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 

回答

1

self.completedDrills不正確初始化。這樣做:

self.completedDrills = [Drill new]; 

並添加初始化方法Drill.m:

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

    } 
    return self; 
}