What's wrong with my self-defined init method?
Posted
by user313439
on Stack Overflow
See other posts from Stack Overflow
or by user313439
Published on 2010-05-03T16:05:56Z
Indexed on
2010/05/03
16:08 UTC
Read the original article
Hit count: 177
objective-c
|iphone
In ClassA:
- (ClassA *)initWithID:(NSString *) cID andTitle:(NSString *) cTitle {
ClassAID = cID;
ClassATitle = cTitle;
return self;
}
In ClassB:
- (void)cellDidSelected {
ClassA *classAController = [[ClassA alloc] init];
//Program received signal: “EXC_BAD_ACCESS” when executing the following line.
classAController = [classAController initWithClassAID:ClassAID andClassATitle:ClassATitle];
NSLog(@"I want to get the value of ID:%@ and Title:%@ here.", [classAController ClassATitle], [classAController ClassAID])
}
Could anyone point where is wrong? Thanks a lot.
© Stack Overflow or respective owner