- (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);
}
}
Почему я получаю EXC_BAD_ACCESS
?Производитель этого исключения, кажется, [super viewDidLoad]; ...
Кто-нибудь может мне помочь?:)
РЕДАКТИРОВАТЬ: немного изменил код .. надеюсь, что это понятно
Вы можете видеть, что я переместил определение массивов в собственный метод.Я также добавил метод, чтобы убедиться, что taskTitle не равен nil (в другом классе).