2012-11-19 45 views
2

我正在开发一个应用程序,使用coredata.I定义NSManagedObjectContext,NsManagedObjectModel,NSPersistentStoreCoordinator在CoreDataRepository对象类而不是AppDelegate.I保存此URL使用引用CoreDataRepository.I获取低于错误。coredata错误?

Undefined symbols for architecture i386: 
    "_OBJC_CLASS_$_CoreDataRepository", referenced from: 
     objc-class-ref in HomeViewController.o 
     objc-class-ref in DashBoardUrlViewController.o 
    ld: symbol(s) not found for architecture i386 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

有关此错误的任何想法。谢谢。

+0

我也试过像你这样做。但我也不能成功。之后,我没有改变这些方法从我的appdelegate NSManagedObjectContext,NsManagedObjectModel,NSPersistentStoreCoordinator。我开始只从appdelegate访问托管对象上下文来编写核心数据的助手类。我认为这个问题的发生只是因为当你在其他视图控制器中使用核心数据时,它开始仅在应用程序委托中搜索方法。 AppDelegate *委托=(AppDelegate *)[[UIApplication SharedApplication]委托];这条线会帮助你。 –

回答

2

链接器找不到您的CoreDataRepository类。查看目标的构建阶段,并根据它定义的位置将该源或库添加到编译阶段或链接阶段。

+0

感谢你得到了答案 – fathik

+0

嗨我解决了上述问题,但该网址没有显示在标签中。它打印“(实体:UrlData; ID:0x86d09b0 ; data:)“ – fathik

+0

这是我的代码NSArray * recordsData = [context executeFetchRequest:request error:&error]; 012MxArray *)recordsData; for(int i = 0; i <[urlMutableArray count]; i ++) { urlString = [NSString stringWithFormat:@“%@”,[urlMutableArray objectAtIndex:0]]; NSLog(@“urlString is%@”,urlString); } – fathik