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.
When I edited and removed a directory I didn't need in Project - Build Settings (next to Info), it was wiping out two of the entries in Framework Search Paths in my App Target in Build Settings. Make sure all the four rows have entries populated automatically from Pod install as shown in the image below: To copy the entries from Debug and Release to the rows below, select one row at a time and hit delete which should copy from the row above. Once I did that, the workspace would build just fine.
After hours of trying things, I discovered the cause. My main app target had 4 build configurations (debug, release, internal, external). However my frameworks (child projects) did NOT have internal, external as they are custom added. Once I added internal/external to my framework projects, all archived fine.
For me, 'Find implicit Dependencies' was unchecked. and it was the issue. Worked fine once I
checked
it.The path:
Edit Scheme > Build > Find implicit Dependencies
I had a similar issue when adding Fabric to my project. I had multiple targets (Release and Dev). It would throw
No Such Module
forimport Fabric
. What worked for me was to go to Project> Build Phases > Link Binary with Libraries and simply marking the status of both the pod framework as Optional.Things I tried:
The only solution I had to this problem was to expose the Pods-(yourapp) target in the scheme picker (next to the run/stop buttons) and manually build that Pods- target before building and running my main app target again. I hope this can save someone 10 minutes!
Does your app build using the primary target?
If so, I was able to get this working by:
pod install
Here is my final Podfile.