I get an 'EXC_BAD_ACCESS' error when trying to access variable in a function other than the one it was set in
The variable is set in the 'awakeFromNib' function:
//Retrieve Session-ID
sessionID = [self getSessionID];
And accessed in 'searchBtnClick':
NSLog(@"Commening search (%@)",sessionID); // This causes the error
The variable itself is defined in the header:
NSString *sessionID;
Can someone suggest what might be wrong with that?
The part which of getSessionID which returns the value:
NSString *pC = @"";
// Separate Session ID
pC = [initCookie substringFromIndex:10];
pC = [pC substringToIndex:32];
NSLog(@"Got session ID : %@",pC);
return pC;