Reputation: 1191
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
@try {
if ([segue.identifier isEqualToString:@"taskListSegue"])
{
MindMapInformationViewController_iPhone *taskListContentController = [segue destinationViewController];
int selectedIndexPath = [[self.tableView indexPathForSelectedRow] row];
MindMap *newMindMap;
newMindMap = [mindmaps objectAtIndex:selectedIndexPath];
FileManager *fileManager = [[[FileManager alloc] init] autorelease];
[fileManager readFile:newMindMap.pathToMindmapAtDevice parsing:YES];
NSMutableArray *taskArray = [fileManager getArray];
[taskListContentController setTasksOfSelectedMindmap:taskArray];
}
}
@catch (NSException *exception) {
}
}
-(void)setTasksOfSelectedMindmap:(NSMutableArray *)tasks {
@try {
[self initComponents];
if (tasks != nil) {
taskArray = tasks;
}
}
@catch (NSException *exception) {
}
}
-(void)initComponents {
@try {
taskArray = [[NSMutableArray alloc] init];
taskName = [[NSMutableArray alloc] init];
taskOwner = [[NSMutableArray alloc] init];
}
@catch (NSException *exception) {
}
}
-(void)viewDidLoad
{
@try {
[super viewDidLoad];
int i = 0;
for (MindMapTask *newTask in taskArray) {
if (newTask.taskOwner == nil) {
newTask.taskOwner = @"Keine Angabe";
}
[taskName addObject:newTask.taskTitle];
[taskOwner addObject:newTask.taskOwner];
i++;
}
}
@catch (NSException *exception) {
NSLog(@"Exception - %@", exception);
}
}
Why I'm getting EXC_BAD_ACCESS
? The producer of this exception seems to be [super viewDidLoad]; ...
Can anyone help me ? :)
EDIT: Changed the code a bit.. hope its understandable
You can see, that i moved the definiton of the arrays into an own method. I also added a method to make sure, that the taskTitle isn't nil (in an other class).
Upvotes: 0
Views: 886
Reputation: 296
Is taskArray still a valid object? Where is it defined? Was it maybe autoreleased?
When you add a breakpoint at the beginning of the function, are all objects valid? (You can check that in the debugging console, with "po", e.g. "po taskArray")
Upvotes: 0