Muhammad Aamir Ali
Muhammad Aamir Ali

Reputation: 21087

NSInvalidArgumentException iphone

NSString *str = self.completedDrills.drillId;

I am simply setting string but it is giving me exception

NSInvalidArgumentException', reason: '-[__NSCFDictionary drillTitle]: unrecognized selector sent to instance

Here is my Drill class

#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

Upvotes: 0

Views: 64

Answers (1)

ILYA2606
ILYA2606

Reputation: 605

self.completedDrills incorrectly initialized. Do this:

self.completedDrills = [Drill new];

And add Init method to Drill.m:

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

    }
    return self;
}

Upvotes: 1

Related Questions