No such module 'RestKit' with cocoapods and swift

Joped picture Joped · May 1, 2015 · Viewed 59.3k times · Source

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

After creating that file I run pod install and reopen xcode with the test-fb-swift4.xcworkspace file.

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 have tried adding and removing the use_frameworks, with and without the target. With and without the :inhibit_warnings.

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.

Answer

BHuelse picture BHuelse · Dec 10, 2015

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.