Hi Guys,
I've a problem with my TableController.
When I call cellForRowAtIndexPath() I'm able to retrieve info from Database class with:
myGroupsAppDelegate *appDelegate = (myGroupsAppDelegate *)[[UIApplication sharedApplication] delegate];
myGroupsDB *mgdb = [ appDelegate.groups_db objectAtIndex:indexPath.row ];
cell.textLabel.text = mgdb.group_name;
[mgdb release];
but if I try to call the same from didSelectRowAtIndexPath() I get an error. I need to pass two values to a view and I'm using this code:
SingleGroupView *sgv = [[SingleGroupView alloc] initWithNibName:@"SingleGroupView" bundle:[NSBundle mainBundle]];
myGroupsAppDelegate *appDelegate = (myGroupsAppDelegate *)[[UIApplication sharedApplication] delegate];
myGroupsDB *mgdb = [ appDelegate.groups_db objectAtIndex:indexPath.row ];
sgv.groupID = mgdb.id_group;
sgv.groupName = mgdb.group_name;
[mgdb release];
When I try to assign mgdb.id_group to sgv.groupID I get a EXC_BAD_ACCESS. It seems that mgdb is empty.
-------------- CHANGE ------------------
After a Build and Analyze, compiler shown "Incorect decrement of the reference count of an object that is no owner at this point". But, I create here, isn't it local? So I added a retain:
myGroupsDB *mgdb = [[ appDelegate.groups_db objectAtIndex:indexPath.row ] retain];
and now it works, but, if I try to recall the same code (just pressing on row, change view, come back and press row again) the application chrash without log and with the same message.
Any suggestion?
thanks, Andrea