나는 다음과 같은 방법으로 자동 생성 된 코드에 대한 다른 인식 할 수없는 선택의 오류에 관한 게시물,하지만 아무것도 본 적이 :코어 데이터 충돌 인식 할 수없는 선택
- (void)tableView:(UITableView *)tableView commitEditingStyle:forRowAtIndexPath:
I 삭제 슬쩍 경우가 호출
하고, 내가 삭제 버튼을 누를 때 나는 다음과 같은 오류가 발생합니다 :
-[Vehicle removeObjectFromGasUpsAtIndex:]: unrecognized selector sent to instance 0x8172c60
내 NSManagedObject 클래스, 차량, 내가 그것을 삭제하려는 경우이 메시지에 응답해야 NSOrderedSet 변수라는 이름의 gasUps 있습니다. 또는 그래서 나는 생각했다.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// need to delete gas up and not vehicle
int row = [indexPath row];
//[self.selectedVehicle removeObjectFromGasUpsAtIndex:row];
[self.selectedVehicle removeObjectFromGasUpsAtIndex:row];
NSError *error = nil;
if (![self.managedObjectContext save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
}
왜 이런 선택을 인식 할 수없는 : 여기에
는 충돌되는 전체 방법?편집 : 이것은 Jody를위한 것입니다. 주문 일대에 대한 접근을 생성
if (self.vehiclesArray != nil && [self.vehiclesArray count] != 0 && self.vehicleIndex != -1) {
// enable add buttom
[self.navigationItem.rightBarButtonItem setEnabled:YES];
self.selectedVehicle = [self.vehiclesArray objectAtIndex:self.vehicleIndex];
NSLog(@"set selected vehicle");
} else {
// disable add button
[self.navigationItem.rightBarButtonItem setEnabled:NO];
// set vehicle defaults to -1 and make disable add buttom
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger:-1 forKey:@"vehicleIndex"];
[defaults synchronize];
NSLog(@"set index to -1");
}
기본적으로 유용한 정보는 제공하지 않습니다. 그냥 오류, 그리고 코드 줄. 기본적으로 다른 문맥은 없습니다. 우리는 독자들을 신경 쓰지 않습니다. 우리가 말할 수있는 것은 런타임과 동일합니다 : 객체는 선택기'removeObjectFromGasUpsAtIndex'를 인식하지 못합니다. 자, 만약'Vehicle' 타입을 정의하는 코드를 보여주고 싶다면'self.selectedVehicle'과 어쩌면 객체의 로그를 메시지를 보내기 전에 어떻게 설정하는지 ... 그러면 아마도 당신은 도움. –
[NSOrderedSet에서 생성 된 접근 자에 예외가 발생했습니다.] (http://stackoverflow.com/questions/7385439/exception-thrown-in-nsorderedset-generated-accessors) – jrturton