2012-08-31 4 views
0
실수로 내 핵심 데이터 모델 파일을 삭제

, 그때 다시 추가하려고했으나 지금 내 응용 프로그램은 다음 던졌습니다 :실수 XCDataModel 삭제 - 응용 프로그램은 이제 NSInvalidArgumentException 발생 - 아이폰

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model' 
*** First throw call stack: 
(0x1ef6022 0x186ecd6 0x1593a75 0x3021 0x2cea 0x34b0 0x26e5 0x6f0386 0x6f1274 0x700183 0x700c38 0x6f4634 0x2089ef5 0x1eca195 0x1e2eff2 0x1e2d8da 0x1e2cd84 0x1e2cc9b 0x6f0c65 0x6f2626 0x22ed 0x2255) 
terminate called throwing an exception(lldb) 

사람이 설명 할 수 내 애플 리케이션을 다시 작동 시키려면 어떻게해야합니까?

건배,

+0

삭제하기 전에 롤백하려면 버전 제어 시스템을 사용하십시오. 실패하면 목표에 추가되었는지 확인하십시오. –

+0

당신은 자식을 사용하고 있지 않습니까? 그러면 쉽게 복원 할 수 있습니다. –

답변

0

Tysin

분명히 하나의 소스 컨트롤의 일부 양식을 사용해야하지만, 이것은 내가 저장소를 작성하지 않은 작은 프로젝트였다.

NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"AppName" withExtension:@"momd"]; 

에 : 단지

NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"AppName" withExtension:@"momd"]; 

내가

// Returns the managed object model for the application. 
// If the model doesn't already exist, it is created from the application's model. 
- (NSManagedObjectModel *)managedObjectModel 
{ 
    if (_managedObjectModel != nil) { 
     return _managedObjectModel; 
    } 
    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"AppName" withExtension:@"momd"]; 
    _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 
    return _managedObjectModel; 
} 

내가 라인을 변경 : 방법에서

: 같은 배에있는 사람들을 위해 다음과 같은 상황이 내 문제를 해결 모델 파일 확장자에서 'd'를 제거하고 모든 것이 효과가있었습니다.

관련 문제