2012-01-17 3 views
0

나는 픽업을 ViewController에두고 레이블에 결과가 인쇄됩니다. 여기CoreData에 UILabel 결과 저장

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 
{ 
    mlabel.text= [arrayNo objectAtIndex:row]; 
} 

코어에 라벨 결과를 저장하는 코드입니다 : 내가 오류 코드 여기

"[<__NSCFConstantString 0xf488> valueForUndefinedKey:]: this class is not key value coding-compliant for the key attribute.'. 

을 받고, CoreData에 결과를 저장하는 데 문제가 라벨을 출력 코드입니다 데이터 :

- (IBAction)editSaveButtonPressed:(id)sender 
{ 

    if (!currentCategory) 
     self.currentCategory = (Entity *)[NSEntityDescription insertNewObjectForEntityForName:@"Entity" inManagedObjectContext:self.managedObjectContext]; 

    [self.currentCategory setAttribute:[mlabel text]]; //This is the line causing the error 

    NSError *error; 

    if (![self.managedObjectContext save:&error]) 
     NSLog(@"Failed to add new category with error: %@", [error domain]); 

    [self.navigationController popViewControllerAnimated:YES]; 
} 

왜이 오류가 발생합니까? 입력 해 주셔서 미리 감사드립니다.

답변

1

Entity에 정의 된 attribute 속성 (따라서 setAttribute)이없는 것처럼 보입니다.

당신은 코어 데이터에 대한이 튜토리얼을 확인 할 수 있습니다 : 입력에 대한 http://www.raywenderlich.com/934/core-data-tutorial-getting-started

+0

감사합니다. 실제로 프로토콜에 대해 자습서를 확인하고 있으며 도움이 될만한 대표자가 있습니다. – PopUp