iOS swift尝试使用集成时出错
我使用POD成功地添加了集成,并且编译时没有出现错误。现在我正在向AppDelegate.swift文件添加代码。生成失败,原因是iOS swift尝试使用集成时出错,ios,swift,core-data,icloud,ensembles,Ios,Swift,Core Data,Icloud,Ensembles,我使用POD成功地添加了集成,并且编译时没有出现错误。现在我正在向AppDelegate.swift文件添加代码。生成失败,原因是 Undefined symbols for architecture armv7: "_OBJC_CLASS_$_CDEPersistentStoreEnsemble", referenced from: __TMaCSo26CDEPersistentStoreEnsemble in AppDelegate.o "_CDEMonitoredMan
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)
我认为AppDelegate.swift中的相关代码是
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
}
我的错误可能就在眼前,但我不知道
我的桥接头.h看起来像
#import <Foundation/Foundation.h>
#import <Ensembles/Ensembles.h>
#import "DropboxSDK.h"
#import "CDEDropboxCloudFileSystem.h"
#导入
#进口
#导入“DropboxSDK.h”
#导入“CDEDropboxCloudFileSystem.h”
很可能您的桥接头未被读取
在“生成设置”下,确保Swift编译器-代码生成下的Objective-C桥接标头生成设置具有指向标头的路径。
路径应与项目相关,类似于在生成设置中指定Info.plist路径的方式。在大多数情况下,您不需要修改此设置
根据您的设置,您可能还需要在Swift文件中导入框架
import Ensembles
您是否添加了桥接头以将Ensembles Objective-C文件导入swift?是的,我在上面进行了更新以显示它如果swift中的Ensembles不起作用,是否有人可以建议其他解决方案?我正在尝试将数据保存到icloud,并与多个设备同步。核心数据很好,但不是100%必需的。以下是swift中的一个示例,它可能会帮助您-我即将开始使用swift向我的应用程序添加集成,希望一切顺利,您最终让它工作了吗?当我添加“导入集成”时,我得到一个“没有此类模块的集成”错误。我的桥接头中有其他正在读取和使用的条目,如#import“SWRevealViewController.h”其他.h文件正在桥接头中工作。如果您在我的AppDelegate.swift文件中询问“import Ensembles.h”,它会出现错误“No-this module‘Ensembles.h’”,也许您不需要导入。如前所述,这取决于您的设置-这取决于集成是如何构建的。是的,如果我尝试在那里导入或不导入它,它不会改变我得到的错误。不幸的是,对于像我这样的新用户,Ensembles没有任何Swift文档或代码示例。