Ensembles setup code causes linker errors; remove the code, no errors

77 Views Asked by At

This is the code (copied and modified from the "book") I'm trying to incorporate into my app (it's basically the same code I was using in another app (in 2014), where I didn't get any build/linker errors):

//  Ensemble: load the model
NSManagedObjectModel *model = [NSManagedObjectModel MR_newManagedObjectModelNamed:@"Books.momd"];
[NSManagedObjectModel MR_setDefaultManagedObjectModel:model];

//  setup CoreData stack
[MagicalRecord setShouldAutoCreateManagedObjectModel:NO];
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"bim.sqlite"];  //  enable Core Data migration

//  setup Ensemble
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"Books" withExtension:@"momd"];
NSURL *storeURL = [NSPersistentStore MR_urlForStoreName: [MagicalRecord defaultStoreName]];

//     setup Ensemble (NOTE: the following 3 lines are causing the errors)
cloudFileSystem = [[CDEICloudFileSystem alloc] initWithUbiquityContainerIdentifier: @"iCloud.com.pragerphoneapps.BookstoreInventoryManager"];

ensemble = [[CDEPersistentStoreEnsemble alloc] initWithEnsembleIdentifier:@"BookInventoryMgr"
                                                       persistentStoreURL: storeURL
                                                    managedObjectModelURL:modelURL
                                                          cloudFileSystem:cloudFileSystem];
ensemble.delegate = self;

//  set default NSManagedObjectContext for MagicalRecord
defaultContext = [NSManagedObjectContext MR_defaultContext];  //  set default NSManagedObjectContext

//  leech it is next

I'm getting these linker errors:

Ld /Users/rolfmarsh/Library/Developer/Xcode/DerivedData/BookstoreInventoryManager-ehprguuncdbjjpeteojkrlqtyyym/Build/Products/Debug-iphonesimulator/BookstoreInventoryManager.app/BookstoreInventoryManager normal i386
cd "/Users/rolfmarsh/Documents/iPad Projects/BookstoreInventoryManager"
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -L/Users/rolfmarsh/Library/Developer/Xcode/DerivedData/BookstoreInventoryManager-ehprguuncdbjjpeteojkrlqtyyym/Build/Products/Debug-iphonesimulator -F/Users/rolfmarsh/Library/Developer/Xcode/DerivedData/BookstoreInventoryManager-ehprguuncdbjjpeteojkrlqtyyym/Build/Products/Debug-iphonesimulator -F/Users/rolfmarsh/Documents/iPad\ Projects/BookstoreInventoryManager/BookstoreInventoryManager -F/Users/rolfmarsh/Documents/iPad\ Projects/BookstoreInventoryManager -filelist /Users/rolfmarsh/Library/Developer/Xcode/DerivedData/BookstoreInventoryManager-ehprguuncdbjjpeteojkrlqtyyym/Build/Intermediates/BookstoreInventoryManager.build/Debug-iphonesimulator/BookstoreInventoryManager.build/Objects-normal/i386/BookstoreInventoryManager.LinkFileList -mios-simulator-version-min=8.0 -Xlinker -objc_abi_version -Xlinker 2 -lz -ObjC -fobjc-arc -fobjc-link-runtime -lz -lsqlite3 -framework Security -framework QuartzCore -lxml2 -framework Fabric -framework Crashlytics -framework CoreGraphics -framework UIKit -framework CloudKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/rolfmarsh/Library/Developer/Xcode/DerivedData/BookstoreInventoryManager-ehprguuncdbjjpeteojkrlqtyyym/Build/Intermediates/BookstoreInventoryManager.build/Debug-iphonesimulator/BookstoreInventoryManager.build/Objects-normal/i386/BookstoreInventoryManager_dependency_info.dat -o /Users/rolfmarsh/Library/Developer/Xcode/DerivedData/BookstoreInventoryManager-ehprguuncdbjjpeteojkrlqtyyym/Build/Products/Debug-iphonesimulator/BookstoreInventoryManager.app/BookstoreInventoryManager

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

How do I fix this?

1

There are 1 best solutions below

0
SpokaneDude On BEST ANSWER

Found the problem... Just in case others have the same problem: Link Binaries with Libraries was missing libEnsembles.a and libPods.a