CocoaPods pod install. Modules cannot be imported

末鹿安然 提交于 2019-12-31 03:44:07

问题


I installed CocoaPods by using $ sudo gem install cocoapods.

I have a swift Xcode project with the following podfile

platform :ios, '8.2'
use_frameworks!

target 'Clover' do

pod 'Alamofire', '~> 1.2'
pod 'SwiftyJSON', '~> 2.2'
pod 'ObjectMapper', '~> 0.12'
pod 'ImageLoader', '~> 0.3.0'
pod 'SVProgressHUD'

end

target 'CloverTests' do

end

After I run pod install, which seems to run correct with no error messages, I have a Pods folder generated with Pods.xcodeproject along with several other files.

However, when attempting to compile the project, I will into errors telling me my modules are not found. The error message is No such module followed by the module name.

I then attempted to install the modules manually and confirmed that the pods are indeed not working as each module after its manual installation, works.

I have searched and attempted several solutions as follows:

  1. Deleted and reinstall pod.
  2. Upgraded ruby to 2.2.1
  3. Delete the pods folder and re-run $ pods install.
  4. Clean the project.

回答1:


More a comment than an answer, but I don't have enough reputation to comment:

When you use pod install with your-project.xcodeproject, it creates a new file/folder named your-project.xcodeworkspace (…project becomes …workspace) and this is this new file that you should open.

You didn't mention whether or not you knew that, so here you go: close the .xcodeproject in Xcode and open the .xcodeworkspace instead and it should work.



来源:https://stackoverflow.com/questions/30809206/cocoapods-pod-install-modules-cannot-be-imported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!