Hi all,
my app generates this error: EXC_BAD_ACCESS
Checking internet i see the problem can be:
* access protected or non-existent memory space as result of a bad pointer
* access memory without alloc init
* access memory after released object
* remove the [object release] only if you don’t use alloc/copy/retain
* trying to access release objects
* illegal memory access
so looks like very clear i'm reading something "can not be read".
My app is very simple and has only a table with two elements inside. Touching the item a second view will appear showing details about the item touched (inside two different text boxes). Changing the text and touching a save button the table will appear again and the item will be updated.
I receive this exception sometimes after touching the button save sometimes touching the item within the table.
How can i see which instruction generates the error?
This is the save button code:
this is the table item touch:
this is the code i use to update the table:
and this is the code i use to fill the table:
Thanks,
stè
my app generates this error: EXC_BAD_ACCESS
Checking internet i see the problem can be:
* access protected or non-existent memory space as result of a bad pointer
* access memory without alloc init
* access memory after released object
* remove the [object release] only if you don’t use alloc/copy/retain
* trying to access release objects
* illegal memory access
so looks like very clear i'm reading something "can not be read".
My app is very simple and has only a table with two elements inside. Touching the item a second view will appear showing details about the item touched (inside two different text boxes). Changing the text and touching a save button the table will appear again and the item will be updated.
I receive this exception sometimes after touching the button save sometimes touching the item within the table.
How can i see which instruction generates the error?
This is the save button code:
Code:
- (void) save
{
self.event.name = self.name.text;
self.event.description = self.description.text;
[self.navigationController popViewControllerAnimated:YES];
}
this is the table item touch:
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
selectedEvent = [listEvents objectAtIndex:indexPath.row];
self.eventController.event = selectedEvent;
[self.navigationController pushViewController:eventController animated:YES];
}
this is the code i use to update the table:
Code:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (selectedEvent != nil) {
NSIndexPath *updatePath = [NSIndexPath indexPathForRow:[listEvents indexOfObject:selectedEvent] inSection:0];
NSArray *updatePaths = [NSArray arrayWithObject:updatePath];
[self.tableView reloadRowsAtIndexPaths:updatePaths withRowAnimation:NO];
selectedEvent = nil;
}
}
and this is the code i use to fill the table:
Code:
- (void)viewDidLoad {
[super viewDidLoad];
listEvents = [[NSMutableArray alloc] init];
Event *event = [[Event alloc] initWithName:@"Primo evento" description:@"Questo è il primo evento inserito"];
[listEvents addObject:event];
Event *event2 = [[Event alloc] initWithName:@"Secondo evento" description:@"Questo è il secondo evento inserito"];
[listEvents addObject:event2];
EventViewController *newEventController = [[EventViewController alloc] init];
self.eventController = newEventController;
//EventViewController *eventController = [[EventViewController alloc] init];
Event *selectedEvent = [Event alloc];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
}
Thanks,
stè