Errors in iOS swift trying to use Ensembles

397 Views Asked by At

I successfully added Ensembles using pods and compiled with no errors. Now I'm adding 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 error 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"
1

There are 1 best solutions below

5
On

Most likely your bridging header is not read.

Under Build Settings, make sure the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header. The path should be relative to your project, similar to the way your Info.plist path is specified in Build Settings. In most cases, you should not need to modify this setting.

Depending on your setup, maybe you also need to import the framework in your Swift file.

import Ensembles