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

没有这样的模块

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

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

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


当前回答

在尝试了这个线程上的所有想法后,当我更新cocoapods时,它起作用了。

$ pod --version
$ 1.0.0 // should have been 1.10.0

你应该更新cocoapods

gem which cocoapods

其他回答

在我的例子中: 该问题只发生在Xcode 12.4,而不是Xcode 13。 测试目标的一个框架在我为arm64模拟器支持重新构建框架后给出了这个错误(在XCFramework格式)。我通过更新框架搜索路径中的路径来修复它

"$(SRCROOT)/Carthage/Build/WireTesting.xcframework/ios-x86_64-simulator" 

to

"$(SRCROOT)/Carthage/Build/WireTesting.xcframework/ios-arm64_x86_64-simulator" 

有时豆荚分解,然后豆荚安装也帮助我。

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

我得到了相同的错误

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