coreData를 사용하면서 폴더와 파일간에 일대일 관계가 많습니다.단일 ManagedObjectContext를 사용하는 NSManagedObject의 NSMergeConflict
내가 밖으로 내 응용 프로그램을 통해 하나의 MOC를 사용하고하는 것은 .I은 저장 후 삭제, 추가, 편집 등의 작업을 수행, 다른
viewControllers에 전달하고 있어요.
내 rootViewController는 NSfetchResultsController를 사용하여 폴더를 만들어 저장하고 내 테이블에 표시합니다.
여는 동안, 나는 VC 이런 식으로 다음
FileViewController *file = [[FileViewController alloc] initWithNibName:@"FileViewController" bundle:nil];
file.managedObjectContext = self.managedObjectContext;
file.controller = self.controller;
을 제기 할 MOC를 통과, 나는 그것을 내가 폴더를 선택할 때마다
NSError *error;
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();
}
후, 나는 파일의 ViewController를 열고이 방법을 절약 FileVC 안에 파일을 만들고이 방법으로 FileVC에 다시 저장하십시오.
NSError *error;
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();
}
2 개의 MOC 또는 단일 MOC를 사용합니까? 내 appdelegate.m에서
, 나는 또한 내가 폴더 안에 파일을 추가 할 때, 나는
이
감사 도와주세요 "NSManagedObject에 대한 NSMergeConflict"를 얻을 때로는이
self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
_navigationController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController];
[self.managedObjectContext setMergePolicy:NSMergeByPropertyStoreTrumpMergePolicy];
self.rootViewController.managedObjectContext = self.managedObjectContext;
시도 란짓.
안녕하세요 친구, 제발 도와주세요 – Ranjit
a) 어떻게 MOM을 만드나요? b) 오류가 무엇이라고 말합니까? c) 여러 번 하시겠습니까? –