为什么Core Data没有链接到我的移植iOS-> Mac App?

时间:2012-03-30 19:05:31

标签: iphone ios macos core-data linker

我正在将应用程序从iOS端移植到Mac端,并且我遇到了令人讨厌的链接错误,其中链接器似乎正在尝试使用iOS版本的coredata框架而不是(x86_64)框架。我删除了框架并重新添加它,并知道我正在添加mac版本。我也重新生成了我的模型类。我收到了这个错误:

 ld: warning: ignoring file /Users/xxxxx/xcode_projects/xxxxx/CoreData.framework/CoreData, file was built for unsupported file format which is not the architecture being linked (x86_64)
     Undefined symbols for architecture x86_64:
     "_NSSQLiteStoreType", referenced from:
     -[CoreDataSingleton persistentStoreCoordinator] in CoreDataSingleton.o
     "_NSInferMappingModelAutomaticallyOption", referenced from:
     -[CoreDataSingleton persistentStoreCoordinator] in CoreDataSingleton.o
     "_NSMigratePersistentStoresAutomaticallyOption", referenced from:
     -[CoreDataSingleton persistentStoreCoordinator] in CoreDataSingleton.o
     "_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
     objc-class-ref in CoreDataSingleton.o
     "_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
     objc-class-ref in CoreDataSingleton.o

     etc...

     ld: symbol(s) not found for architecture x86_64


     clang: error: linker command failed with exit code 1 (use -v to see invocation)

任何建议都会有所帮助,谢谢,

尼克

1 个答案:

答案 0 :(得分:13)

链接错误通常意味着您没有在项目中包含框架。

在项目构建设置的“构建阶段”选项卡的“链接二进制库”部分中,确保列出了CoreData.framework。如果没有,请按“+”按钮并选择它。enter image description here