集成设置代码导致链接器错误;删除代码,没有错误
Ensembles setup code causes linker errors; remove the code, no errors
这是我试图合并到我的应用程序中的代码(从 "book" 复制和修改)(它与我在另一个应用程序(2014 年)中使用的代码基本相同,但我没有没有得到任何 build/linker 错误):
// 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
我遇到了这些链接器错误:
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)
我该如何解决这个问题?
找到问题...以防其他人遇到同样的问题:Link 缺少带库的二进制文件 libEnsembles.a 和 libPods.a
这是我试图合并到我的应用程序中的代码(从 "book" 复制和修改)(它与我在另一个应用程序(2014 年)中使用的代码基本相同,但我没有没有得到任何 build/linker 错误):
// 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
我遇到了这些链接器错误:
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)
我该如何解决这个问题?
找到问题...以防其他人遇到同样的问题:Link 缺少带库的二进制文件 libEnsembles.a 和 libPods.a