I need to call a method that has been defined in the same class.I am calling the method initiateSession from the function A.
-(BOOL)intitiateSession
{
//stmts
return YES;
}
-(BOOL)A
{
if([self initiateSession])
{
//stmts
}
return YES;
}
getting a runtime error as,
Terminating app due to uncaught exception
cannot init a class object
EDITED:
@implementation Data
-(BOOL)initiateSession
{
NSLog(@"I am into the initiateSession!!");
return YES;
}
-(BOOL)getNHPData{
NSLog(@"In getNHPData!!");
if([self initiateSession])
{
NSLog(@"I am into the session");
}
return YES;
}
@end
Here in the if loop i will call the function.Execute the function and if the function
executes to true i'm getting inside the scope.I could not able to call one function from
other function.
self = [super init]is inside yourinitmethod. - Terry Wilcox