2009-08-21 8 views
0

앱이 정상적으로 작동하고 충돌이 발생합니다. 크래시가 메모리를 정리하고 클린 런이 메모리를 손상시키는 것처럼 보입니다.내 iPhone 시뮬레이터가 계속 충돌합니다. 실행합니다.

나는 그것이 메모리 할당과 관련이 있다고 생각하지만 확실하지 않습니다.

alt text

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *MyIdentifier = @"MyStateCell"; 
static NSString *MyNib = @"StateCell"; 

StateCell *cell = (StateCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 

if (cell == nil) { 
    UIViewController *c = [[UIViewController alloc] initWithNibName:MyNib bundle:nil]; 
    cell = (StateCell *)c.view; 

    [c autorelease]; 
} 

// Configure the cell. 
NSString *cellAnswerName = [[NSString alloc] initWithFormat:@""]; 
cellAnswerName = [theQuizArray objectAtIndex:indexPath.row]; 
int theStatusCode = [[theResultArray objectAtIndex:indexPath.row] intValue]; 

NSString *statusString; 
NSString *pointsWon; 

if(theStatusCode == 0){ 
    statusString = [NSString stringWithFormat:@""]; 
    pointsWon = [NSString stringWithFormat:@""]; 
}else if(theStatusCode == 12){ 
    statusString = [NSString stringWithFormat:@"Wrong"]; 
    pointsWon = [NSString stringWithFormat:@"0"]; 
}else if(theStatusCode == 11){ 
    statusString = [NSString stringWithFormat:@"Out of time"]; 
    pointsWon = [NSString stringWithFormat:@"0"]; 
}else{ 
    int elapsedTime = 10 - theStatusCode; 
    int pointsWonInt = 10 * theStatusCode; 
    pointsWon = [NSString stringWithFormat:@"%i", pointsWonInt]; 
    if(elapsedTime == 1){ 
     statusString = [NSString stringWithFormat:@"%i second", elapsedTime]; 
    }else{ 
     statusString = [NSString stringWithFormat:@"%i seconds", elapsedTime]; 
    } 
} 

NSString *imagePath = [[@"State_" stringByAppendingString:cellAnswerName] stringByAppendingString:@".png"]; 
UIImage *image = [UIImage imageNamed:imagePath]; 

[[cell stateImage] setImage:image]; 
[[cell stateName] setText:cellAnswerName]; 
[[cell stateResult] setText:statusString]; 
[[cell statePoints] setText:pointsWon]; 


if([statusString isEqualToString:@"Wrong"]) 
[[cell stateResult] setTextColor:[UIColor redColor]]; 


return cell; 

} 꽤 기괴한

답변

0

.

"다른 모든 실행"이라고 말하면 앱을 어떻게 실행하고 있습니까? 빌드하고 실행 하시겠습니까? 아니면 그냥 달리는거야?

빌드 및 실행하는 경우 파일을 복사하거나 사용자 지정 처리를 수행하는 사용자 지정 빌드 단계가 있습니까?

백 트레이스는 NIB로드 중에 충돌이 있음을 나타내며 특히 콘센트를 설정할 때 발생합니다. 파일의 소유자로서 잘못된 개체가있을 가능성이 있습니까? 어쩌면 응용 프로그램 시작시 파일 시스템에서 읽는 내용에 따라 다른 코드 경로가 있을까요?

+0

항상 빌드 및 실행 – Bryan

+0

사용자 지정 처리를 수행하지 않습니다. 텍스트 파일에 데이터를로드하기 만하면됩니다. 미친 일이 없습니다. 귀하의 답변에 감사드립니다 bbum – Bryan

+0

귀하의 cellForRowAtIndexPath 메서드 – Jordan

관련 문제