[英]No Such Module 'Ensembles' Error - importing objective-c framework to use in swift project
I am add Ensembles to my Swift project - found here https://github.com/drewmccormack/ensembles . 我将Ensembles添加到我的Swift项目中 - 在这里找到https://github.com/drewmccormack/ensembles 。 I have had no luck adding iCloud support to my app and syncing data across devices so hoping this will work.
我没有运气添加iCloud支持到我的应用程序和跨设备同步数据,所以希望这将工作。
I have followed the following instructions for adding the framework to my app, 我已按照以下说明将框架添加到我的应用程序,
Select the Build Settings tab. 选择“构建设置”选项卡。 Locate the Other Linker Flags setting, and add the flag -ObjC.
找到Other Linker Flags设置,并添加标志-ObjC。
This is how it looks in my project, I am unsure if i have done this step right. 这就是它在我的项目中的样子,我不确定我是否已经做好了这一步。
It is step 10 that I am having problems with. 我遇到问题是第10步。 Do I have to create a bridging header or just import the framework into my swift files ?
我是否必须创建桥接头或只是将框架导入我的swift文件?
This is how I am importing within my CoreDataStack.swift
file 这是我在
CoreDataStack.swift
文件中导入的方式
import UIKit
import CoreData
import Ensembles
class CoreDataStack: NSObject, CDEPersistentStoreEnsembleDelegate {
}
This gives me the error; 这给了我错误;
No such module 'Ensembles'
没有这样的模块'Ensembles'
I tried creating a bridging header by doing the following; 我尝试通过执行以下操作创建桥接标头;
This is how that looks; 这是看起来如何;
#ifndef Header_h
#define Header_h
#import <Ensembles/Ensembles.h>
#endif /* Header_h */
But still no luck, does anybody know where I am going wrong when trying to import the framework to use with my swift project ? 但是仍然没有运气,在尝试导入框架以使用我的swift项目时,是否有人知道我哪里出错了?
When creating a bridging header you do not need to use import. 创建桥接头时,您不需要使用导入。
However I don't think you may be adding a bridging header correctly, go to, file, new, file, add a objective-C file and a dialog should pop up asking if you want to create a bridging header. 但是我不认为你可能正确地添加了一个桥接头,转到,文件,新建,文件,添加一个Objective-C文件,然后会弹出一个对话框,询问你是否要创建一个桥接头。 Add both files but delete the objective-C file and keep the bridging header.
添加两个文件但删除objective-C文件并保留桥接标头。
Then import the ensembles framework to the bridging header like so. 然后将ensembles框架导入桥接头,就像这样。
#import <Ensembles/Ensembles.h>
When creating a bridging file successfully you should not need to import the framework in your swift files and it should be available throughout your project. 成功创建桥接文件时,您不需要在swift文件中导入框架,它应该在整个项目中可用。 See this post for more information - Connect Objective C framework to Swift iOS 8 app (Parse framework)
有关更多信息,请参阅此文章 - 将Objective C框架连接到Swift iOS 8应用程序(Parse框架)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.