2013-11-26 5 views
0

Xcode에서 같은 오류가 발생하여 그 이유를 알아낼 수 없습니다. 아래의 uitexfield 코드를 사용하여 저장 한 데이터를 검색하려고합니다. 그 부분은스토리 보드의 UITableViewCell에서 데이터를 가져 오는 중

- (IBAction)saveCourseDetail:(id)sender 
{ 
    NSMutableDictionary *courseDictionary=[NSMutableDictionary new]; 
    [courseDictionary setObject:courseName.text forKey:@"courseName"]; 
    [courseDictionary setObject:courseDescription.text forKey:@"courseDescription"]; 
    [courseDictionary setObject:classRoom.text forKey:@"classRoom"]; 
    [courseDictionary setObject:teacherName.text forKey:@"teacherName"]; 
    [courseDictionary setObject:buildingName.text forKey:@"buildingName"]; 

    NSUserDefaults *savedData=[NSUserDefaults standardUserDefaults]; 
    [savedData setObject:courseDictionary forKey:@"courseDictionary"]; 
    [savedData synchronize]; 
// [self.delegate reloadTableData]; 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"CourseAddedNotification" object:nil]; 
    [self.navigationController popViewControllerAnimated:YES]; 
} 
#pragma mark Course Tableview 


    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     NSString *string = [_dataArray objectAtIndex:indexPath.row]; 

     NSString *CellIdentifier = @"Cell"; 

     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

     if(cell==nil) 
     { 
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
     } 
     cell.textLabel.text=string; 

     return cell; 
    } 
    and the tableview that i'm trying to get the saved course details 



#pragma mark - Table View Delegate - 

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    return 10; 
} 

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    CourseCell *cell=[tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 
    if (!cell) { 
     cell = [[CourseCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; 
    } 
    return cell; 
} 

을 절약하지만이 같은 오류가 계속 which- 2013년 11월 26일 14 : 43 : 19.496 SidebarDemo [1170 : 70B] *에서 어설 션 실패 - [jQuery과 dequeueReusableCellWithIdentifier : forIndexPath :],/SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m : 5261 2013-11-26 14 : 43 : 19.500 사이드 바 메모 [1170 : 70b] * 'NSInternalInconsistencyException'이라는 캐치되지 않은 예외로 인해 응용 프로그램을 종료합니다. '셀 식별자가있는 셀을 대기열에서 제외 할 수 없습니다. 식별자의 클래스 또는 클래스를 등록하거나 스토리 보드에 프로토 타입 셀을 연결해야합니다.'

아무도 도와 줄 수 없습니다. ?

+1

당신이 셀의 식별자입니다와 스토리 보드의 프로토 타입 셀을 가지고 마십시오 cellForRowAtIndexPath: 방법에 사용하는로? – bobnoble

답변

0

attributinspector에서 스토리 보드의 셀 식별자를 4.tab로 설정해야합니다. 식별자는 소스 코드의 식별자 (여기서는 "셀")와 동일해야합니다.

0

당신은

static NSString *CellIdentifier = @"messageCell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

애플 문서 사용하지 마십시오 사용해야합니다

중요을

당신은 registerNib 사용하여 클래스 나 펜촉 파일을 등록해야합니다

: forCellReuseIdentifier를 : 또는 registerClass : forCellReuseIdentifier :이 호출 전에 메서드 thod. 당신의 storyboard에서 uitableviewCell, 줄 이름 "셀"을

0

추가 identifier 같은 당신은

관련 문제