What is the reason behind not importing Alamofire in my project?

孤街醉人 提交于 2019-11-27 07:33:22

问题


I am making a demo of Alamofire using cocoa-pods.I am referring the tutorial "https://github.com/Alamofire/Alamofire". I tried both manual and by sample procedure .But, when i am importing Alamofire,an error shows like "No such module 'Alamofire' ". So please help me to short out this issue.

Thanks in advance.

回答1:


Follow these steps for installation >

1- open terminal and cd to your project folder 2- Create Podfile and add the code from https://github.com/Alamofire/Alamofire 3- In terminal , run

pod install 

4- Close the project and open again from newly created workspace of projectName.xcworkspace

5- Run and build the project once

Now it should be able to import




回答2:


xcode need time to add Alamofire in to your project. My suggestion:

Press Command + Shift + R to rebuild project.




回答3:


When there is a mismatching version in your 'Podfile' against your Xcode Version, it would cause this issue. For example:

My Xcode Version is 9.2 (see below)

Therefore my Podfile will need to include 9.2 in the platform section (see below on line 2)

After that, go back to your Terminal and recreate the '.xcworkspace' file by executing in the project folder:

pod install

Finally, open your '.xcworkspace' file in Xcode and click Build.

This should resolve the issue



来源:https://stackoverflow.com/questions/38156882/what-is-the-reason-behind-not-importing-alamofire-in-my-project

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