이 코드는 응용 프로그램을 중단시킵니다. 나는 사전을 통해 반복 중이며 모든 것이 잘 기록됩니다. 내가 루프하지만 그렇지 않으면 -1을 쓸 때 그것은 당신이 tableView
와 wokring한다고 가정ReloadTable 응용 프로그램이 충돌합니다.
-(void)updateProjectTimes {
for(int i = 0; i < [projectsTable numberOfRowsInSection:0]-1; i++) {
NSString *currentValue = [[[projects objectForKey:@"activeProjects"] objectAtIndex:i] objectForKey:@"timepassed"];
NSString *finishValue = [[[projects objectForKey:@"activeProjects"] objectAtIndex:i] objectForKey:@"timeleft"];
if([currentValue intValue] < [finishValue intValue]) {
[[[projects objectForKey:@"activeProjects"] objectAtIndex:i] setObject:[NSString stringWithFormat:@"%d", ([currentValue intValue] + 1)] forKey:@"timepassed"];
} else {
[(NSMutableArray *)[projects objectForKey:@"activeProjects"] removeObjectAtIndex:i];
if([[projects objectForKey:@"activeProjects"] count] == 0) {
[projectTimer invalidate];
projectTimer = nil;
}
}
//[projectsTable reloadData]; works if i put it here!
}
[projectsTable reloadData]; //<- But not here!! :(
}
무엇 당신의 실수인가요? – Emil
충돌 로그를 게시하십시오. 코드에서 알 수 없습니다. [편집 된 코멘트는 처음에 '-1'에 대한 언급을 알지 못했습니다. 코드에서 주석으로 더 명확해질 것입니다. – XJones