我目前在Swift编码,我有一个错误:

没有这样的模块

但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。

框架是在Objective-C中,所以我为它写了一个桥标头。

请问,如何让Xcode识别框架?


当前回答

我的解决办法是。在目标->构建设置->框架搜索路径和添加$(继承)。然而,如果它是一个cocoapods,你的答案可能在输出终端内。

其他回答

我得到了相同的错误

import Firebase

但随后注意到,我没有将pod添加到主目标部分,而只是在Podfile中添加到Test和TestUI目标。

用命令

pod init

对于xcode swift项目,会生成以下Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MyApp' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MyAppUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

因此,需要确保将pod添加到任何适当的占位符。

当“查找隐式依赖项”选项未选中时,可能会发生此错误。转到编辑方案->构建。

然后勾选这个选项。

我在开发定制Pod时遇到了这个问题。发现我只需要在我的Procfile中指定依赖项:

Pod::Spec.new do |s|
   # ... other declarations

   s.dependency 'Alamofire', '~> 4.3'
end

如果你使用迦太基,建筑设置中的框架通常是不变的

$ (PROJECT_DIR) /迦太基/构建/ iOS

如果你运行carthage update—platform ios—no- Build(为了节省时间),Build文件夹中的文件将不会被重新创建,那么这些模块将无法用于XCode。

以我为例,我运行了carthage update平台ios,然后我的问题就解决了。

我的问题是有多个目标。 我用以下链接解决了这个问题: 配置pod文件正确的方式和修复构建设置

希望有人会觉得有用。