stackoverflow에서 몇 가지 질문을 읽은 후에도 여전히 답변을 찾을 수 없습니다.ManagedObjectContext를 TabBarViewControllers에 전달하는 방법
appdelegate에서 tabbarcontroller보기로 ManagedObjectContext를 전달하는 데 문제가 있습니다. 내 appdelegate.m에서
나는이
#import "memoView.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
memoView *mView = (memoView *)navigationController.topViewController;
mView.ObjectContext =[self managedObjectContext];
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"NoteLog" inManagedObjectContext:[self ObjectContext]];
[fetchRequest setEntity:entity];
NSError *error;
self.memoInfo = [ObjectContext executeFetchRequest:fetchRequest error:&error];
//self.title = @"Memo";
[fetchRequest release];
}
memoView.m
에서 오류 이유가 '+ entityForName : 엔티티 이름에 대한 NSManagedObjectModel을 찾을 수 없습니다'를 NoteLog ''내가 뭘 잘못했는지 잘 모르겠다. 핵심 데이터에 대해 상대적으로 새로운 것이다.
모든 의견을 환영합니다.
- (BOOL) 응용 프로그램에 코드를 추가합니다. (UIApplication *) application didFinishLaunchingWithOptions : (NSDictionary *) launchOptions – Desmond
mView가 nil인지 테스트 했습니까? – an0