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

没有这样的模块

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

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

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


当前回答

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

其他回答

对我来说,问题在于项目文件缺少这个文件“coursesX.xcworkspace”

当我添加它并重新打开项目时,一切都工作得很好

当我使用Cocoapods添加两个框架时,我得到了相同的错误。如果我们在项目中使用Pods,我们应该使用xcodeworkspace而不是xcodeproject。 为了通过xcodebuild运行项目,我在xcodebuild命令中添加了-workspace <workspacename>参数,它工作得很好。

我得到了相同的错误

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添加到任何适当的占位符。

我只是通过删除引用来删除框架,然后再次添加它们。

在podfile中,删除产生问题的pod,并保存该文件 运行pod安装 重新添加pod,保存文件 重新运行pod安装