Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is CoreData not linking in my ported iOS->Mac App?

I'm porting an app from the iOS side to the Mac side and I'm having an annoying linking error where the linker appears to be trying to use the iOS version of the coredata framework instead of the (x86_64) one. I've deleted the framework and re-added it and know I'm adding the mac version. I've also regenerated my model classes. I'm getting this error:

 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)

Any suggestions would be helpful, thanks,

Nick

like image 559
nickthedude Avatar asked Dec 12 '22 03:12

nickthedude


1 Answers

Link errors usually mean you aren't including a framework in the project.

In the "Link Binary With Libraries" section of the "Build Phases" tab of the build settings for your project, make sure CoreData.framework is listed. If not, press the "+" button and select it.enter image description here

like image 146
Vincent Gable Avatar answered Dec 24 '22 06:12

Vincent Gable