2012-11-19 43 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