i know that this is basic objective C question but I have serious problems. I am having an NSMutable array which I fill with values in my connectionDidFinishLoading. i can see in NSLog that values are being assigned correctly. But when i am trying to fetch these values in DidSelectRow (as I am using a table view I get a BAD_ACESS error)
Here is my code:
@implementation MainMap
{
NSMutableArray *condition ;
}
..
- (void)viewDidLoad
{
[super viewDidLoad];
}
...
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
condition= [NSMutableArray array];
..adding objects..
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//app crashes in here
NSLog(@"Condition of pressed item is %@",[condition objectAtIndex:indexPath.row]);
}
If I place the condition= [NSMutableArray array]; inside ViewDidLoad I get a SIGBART.
Moreover I tried to place the declarations in .h file and have it as property and then synthesize it in .m but still nothing. Maybe I am missing something, so can you fix it?