Bugs in iOS are fast trying to use ensembles
I have successfully added ensembles using containers and compiled without error. Now I add the code to my AppDelegate.swift file. Build fails with
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_CDEPersistentStoreEnsemble", referenced from:
__TMaCSo26CDEPersistentStoreEnsemble in AppDelegate.o
"_CDEMonitoredManagedObjectContextDidSaveNotification", referenced from:
__TFC8nicepal11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb in AppDelegate.o
"_OBJC_CLASS_$_CDEICloudFileSystem", referenced from:
__TMaCSo19CDEICloudFileSystem in AppDelegate.o
"_CDEICloudFileSystemDidDownloadFilesNotification", referenced from:
__TFC8nicepal11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I think the relevant code in AppDelegate.swift is
var ensemble:CDEPersistentStoreEnsemble?
var ensembleCloudFileSystem:CDECloudFileSystem?
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, CDEPersistentStoreEnsembleDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let store_url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("nicepal.sqlite")
let modelURL = NSBundle.mainBundle().URLForResource("nicepal", withExtension: "momd")!
ensembleCloudFileSystem = CDEICloudFileSystem(
ubiquityContainerIdentifier: "something"
)
ensemble = CDEPersistentStoreEnsemble(
ensembleIdentifier: "IDENTIFIER",
persistentStoreURL: store_url,
managedObjectModelURL:modelURL,
cloudFileSystem:ensembleCloudFileSystem
)
ensemble?.delegate = self
NSNotificationCenter.defaultCenter().addObserver(self, selector: "syncWithCompletion:", name: CDEMonitoredManagedObjectContextDidSaveNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "syncWithCompletion:", name: CDEICloudFileSystemDidDownloadFilesNotification, object: nil)
return true
}
My mistake is probably right in front of me, but I don't know.
my Bridging-Header.h looks like
#import <Foundation/Foundation.h>
#import <Ensembles/Ensembles.h>
#import "DropboxSDK.h"
#import "CDEDropboxCloudFileSystem.h"
+3
source to share
1 answer
Chances are your bridging header is not readable.
Under Build Parameters, ensure that the Objective-C Bridging Header Build parameter in Swift Compiler - Code Generation has a header path. The path should be relative to your project, similar to how your Info.plist path is specified in the build settings. In most cases, you do not need to change this setting.
Depending on your setup, you may also need to import the framework into your Swift file.
import Ensembles
0
source to share