Xcode 找不到模块,更新后

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37852614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:55:13  来源:igfitidea点击:

Xcode can't find a module, after updating

xcodeswiftcocoa

提问by Daniel Chepenko

I've recently updated my Xcode, but I faced with strange issue.

我最近更新了我的 Xcode,但我遇到了奇怪的问题。

I'm installing library via cocoapods and use it further in my project, but after updating I Xcode can't find the module, I've installed via CocoaPods

我正在通过 cocoapods 安装库并在我的项目中进一步使用它,但是更新后我 Xcode 找不到模块,我已经通过 CocoaPods 安装了

I've updating pods, but the problem stays. Also I have Pods.framework red

我已经更新了 Pod,但问题仍然存在。我也有 Pods.framework 红色

What is the problem?

问题是什么?

Podfile:

播客文件:

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

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

  # Pods for Bloom

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

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

end

pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Gifu'

UPD: Solved it by opening the project with the .xcworkspace file not with .xcodeproj.

UPD:通过使用 .xcworkspace 文件而不是 .xcodeproj 打开项目来解决它。

回答by Sohil R. Memon

Do the following things and you can import any swift file from "Pods"

执行以下操作,您可以从“Pods”导入任何 swift 文件

  1. Clean your project
  2. Make sure that all your "Pods" > "Build Settings" > "Build Active Architecture Only" is set to "NO".
  3. Don't run, just build your project.
  4. Now, import any file from "Pods" to any swift file
  1. 清理你的项目
  2. 确保所有“Pod”>“构建设置”>“仅构建活动架构”都设置为“否”。
  3. 不要运行,只需构建您的项目。
  4. 现在,将任何文件从“Pods”导入任何 swift 文件

This will solve your import moduleproblem.

这将解决您的import module问题。

Update:

更新:

To solve this issue delete the current pod file and create one using the terminal. Follow the below steps:

要解决此问题,请删除当前 pod 文件并使用终端创建一个。请按照以下步骤操作:

1) Open Terminal.

1) 打开终端。

2) Navigate to your Project Path.

2) 导航到您的项目路径。

3) Type pod initin terminal to create new pod file.

3)pod init输入终端以创建新的 pod 文件。

4) Open the newly created pod file and write the pod line which you want to install after target "TargetName" doand before end.

4)打开新创建的pod文件,在target "TargetName" do前后写上要安装的pod行end

5) Then type pod installin the terminal.

5)然后pod install在终端中输入。

Hope this helps!

希望这可以帮助!

回答by Di Nerd

I had to delete my podfile and ALL the files it made including the .workspace file then I did:

我不得不删除我的 podfile 和它制作的所有文件,包括 .workspace 文件,然后我做了:

pod init
open -a Xcode Podfile 

add pods I want to podfile then save and close xcode.

将我想要的 pod 添加到 podfile 然后保存并关闭 xcode。

Finally do pod install and open the new workspace file :)

最后执行 pod install 并打开新的工作区文件:)

回答by saran

change your pod file like this and clean the project quit xcode and reopen it.it may solve the problem

像这样更改您的pod文件并清理项目退出xcode并重新打开它。它可能会解决问题

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Comment this line if you're not using Swift and don't want to use       
dynamic frameworks
use_frameworks!

target 'Bloom' do

pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Gifu'
end

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

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

回答by Bartosz Kunat

I had the same issue after I tried to merge a branch using Xcode (never again!). What finally worked for me was:

在尝试使用 Xcode 合并分支后,我遇到了同样的问题(再也不会!)。最终对我有用的是:

  1. Deleting derved data
  2. Cleaning project
  3. Exiting Xcode
  4. Running 'pod install' again in my project
  1. 删除派生数据
  2. 保洁工程
  3. 退出Xcode
  4. 在我的项目中再次运行“pod install”

回答by Duyen-Hoa

Some frameworks in cocoapods declare a hard-link to XCode in the module description file (XMPP for example). So, be sure that you have:

cocoapods 中的一些框架在模块描述文件(例如 XMPP)中声明了一个到 XCode 的硬链接。因此,请确保您拥有:

  • place XCode.app in /Application (default folder), with name "XCode.app", not Xcode-beta.app
  • 将 XCode.app 放在 /Application(默认文件夹)中,名称为“XCode.app”,而不是 Xcode-beta.app

or/and

或/和

  • call xcode-select to specify the right XCode.app:

    sudo xcode-select --switch /Applications/Xcode.app

  • 调用 xcode-select 来指定正确的 XCode.app:

    须藤 xcode-select --switch /Applications/Xcode.app