Trying to use class variables in thread and getting EXC_BAS_ACCESS.
Code snippet:
@interface ViewController : UIViewController {
NSString* accountLoginName;
NSString* accountPassword;
}
in implementation:
accountLoginName = [NSString stringWithString:textFieldLoginName.text];
accountPassword = [NSString stringWithString:textFieldPassword.text];
[self performSelectorInBackground:@selector(loginAtBackgroundSelector:) withObject:nil];
-(void)loginAtBackgroundSelector:(UIAlertView*)alert
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"%@\n%@", accountLoginName, accountPassword);
[self login];
[self dismissAlert:alert];
[pool release];
}
just trying to write to console and getting error in this part of code, but error in the loginAtBackgroundSelector appears from time to time.
-(AlertType)login
{
NSLog(@"%@\n%@", accountLoginName, accountPassword);
}
Try this in interface:
And this in the implementation (in the place where you assign the values):
Additionaly in the dealloc:
Let me know if it helps.