没有这样的带有可可足和迅捷的模块“ RestKit” [英] No such module 'RestKit' with cocoapods and swift
问题描述
我在一个全新的项目中遇到了这个问题。 RestKit和Facebook SDK都会发生此问题。奇怪的是,SwiftyJSON可以正常工作。我创建了一个全新的swift项目和一个Podfile:
I am having this problem with a brand new project. This problem happens with both RestKit and Facebook SDK. Strangely SwiftyJSON works just fine. I create a brand new swift project and a Podfile with:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'test-fb-swift4' do
pod "FBSDKCoreKit"
pod 'SwiftyJSON', '~> 2.1'
pod 'RestKit', :inhibit_warnings => true
end
target 'test-fb-swift4Tests' do
end
创建该文件后,我运行pod install并使用test-fb-swift4.xcworkspace文件重新打开xcode。
After creating that file I run pod install and reopen xcode with the test-fb-swift4.xcworkspace file.
现在在里面我的控制器放了一个导入RestKit,但出现错误No No module'RestKit'。我尝试了许多不同的方法来格式化Podfile,甚至可以将其格式化为非常简单的版本,例如:
Now inside my controller I put a import RestKit and I get the error No such module 'RestKit'. I have tried many different ways to format the Podfile even down to very simple versions like:
source 'https://github.com/CocoaPods/Specs.git'
pod 'RestKit'
I尝试添加和删除use_frameworks(带有和不带有目标)。有和没有:inhibit_warnings。
I have tried adding and removing the use_frameworks, with and without the target. With and without the :inhibit_warnings.
我正在运行CocoaPods 0.36.4,并尝试了最新的rc版本,同样的方法。来自另一个项目的Objective-C版本运行良好。这是我的第一个使用Swift的项目,我在这个问题上陷入困境。
I am running CocoaPods 0.36.4 and tried the latest rc build, same deal. The Objective-C version from another project runs fine. This is my first project using Swift and I am stuck on this issue.
推荐答案
我遇到了同样的问题。我的解决方案是使用 .xcworkspace
而不是 .xcodeproj
打开项目。 .xcodeproj
仅包含主项目; .xcworkspace
包括包括Restkit在内的所有内容。
I had the same problem. My solution was to open the project using the .xcworkspace
, not the .xcodeproj
. .xcodeproj
only contains the main project; .xcworkspace
includes everything including Restkit.
这篇关于没有这样的带有可可足和迅捷的模块“ RestKit”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!