我在一个 Objective c 项目上工作,并试图让它与 Swift 一起工作。
我过去已经抛出这个过程,但没有得到这个错误。
添加后use_framworks
到我的 podfile,并用 <> 或 @import 替换所有“”导入,我收到此错误:
重新定义模块Realm
在 module.modulemap
文件:
framework module Realm { //This is the line the error is on
umbrella header "Realm.h"
export *
module * { export * }
explicit module Private {
header "RLMAccessor.h"
header "RLMArray_Private.h"
header "RLMListBase.h"
header "RLMMigration_Private.h"
header "RLMObjectSchema_Private.h"
header "RLMObjectStore.h"
header "RLMObject_Private.h"
header "RLMOptionalBase.h"
header "RLMProperty_Private.h"
header "RLMRealmConfiguration_Private.h"
header "RLMRealm_Private.h"
header "RLMResults_Private.h"
header "RLMSchema_Private.h"
}
explicit module Dynamic {
header "RLMRealm_Dynamic.h"
header "RLMObjectBase_Dynamic.h"
}
}
有什么帮助吗?
谢谢
最佳答案
您只需要使用 use_frameworks!
如果您要引入使用 Swift 代码的依赖项,请在 CocoaPods 中使用关键字。那是你在做什么?
如果您也开始从 Swift 类访问 Realm 代码,请确保您已包含 Swift/RLMSupport.swift
桥接头也是如此。
除此之外,查看 CocoaPods 问题,其中 this sort of issue was reported ,您还应该确保您已经完全删除了 #import ""
的所有痕迹。到处。
如果这仍然对您不起作用,那么您可能需要在您的问题中添加更多信息,以了解您的项目是如何设置的,以及它如何使用 Objective-C 和 Swift,以及您的 podfile 是什么样的。
关于ios - 重新定义模块 'Realm',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38562578/