2012-03-30 40 views
4

我正在将应用程序从iOS端移植到Mac端,并且我有一个恼人的链接错误,其中链接器似乎尝试使用iOS版本的coredata框架而不是(x86_64)框架。我删除了框架并重新添加了它,并知道我正在添加mac版本。我也重新创建了我的模型类。我得到这个错误:为什么CoreData不能在我的移植的iOS-> Mac App中链接?

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) 

任何建议将是有益的,谢谢,

尼克

+0

我重新创建了该项目,似乎修复了链接错误 – nickthedude 2012-03-30 19:44:24

+0

实际上,这并没有工作,只要我开始使用coredata单身人士课程以前一样的方式,所以我猜我仍然搞砸了。我虽然可能与为应用程序委托进行单例前向声明有关,所以我现在正在研究这个问题。 – nickthedude 2012-03-30 19:59:02

+0

检查最后一点,我正在建造旧项目,哈哈。它正在运行,但我有更多的问题来处理,我beleieve与这个原始问题无关,所以我正在考虑解决这个问题。 – nickthedude 2012-03-30 20:07:31

回答

13

链接错误通常意味着你不包括在该项目的框架。

在构建设置,为您的项目“构建阶段”选项卡中的“链接二进制与图书馆”部分,确保CoreData.framework上市。如果没有,请按“+”按钮并选择它。 enter image description here

+0

嘿,谢谢我已经包括了coredata.framework我认为发生了什么是因为一些愚蠢的原因,我最初在框架中从ios项目拖到mac项目,并且因为任何原因它没有过渡到新的架构。即使删除并重新添加它仍然试图链接ios版本的coredata而不是mac版本。 – nickthedude 2012-03-31 00:16:15

相关问题