Module 'Alamofire' has no member named 'request'

北战南征 提交于 2019-11-27 03:43:20

问题


I'm new to iOS Development, I installed Alamofire as said in README, but I have this error as other users and I don't know how to solve it.


回答1:


Alamofire.xcodeproj -> Build Phases -> Complie Sources

If (0 item), then "[+] Alamofire.swift".

It's OK :)




回答2:


2019 UPDATE

If you have this error and you use 'alamofire5' branch just change Alamofire.request to AF.request.




回答3:


if you are using new Alamofire 5.xxx then you will use AF instead of Almofire it like that

AF.upload(multipartFormData: <#T##(MultipartFormData) -> Void#>, to: <#T##URLConvertible#>)  AF.request(<#T##url: URLConvertible##URLConvertible#>)  AF.download(<#T##url: URLConvertible##URLConvertible#>) 



回答4:


I solved this issue by changing the Build Active Architectures Only settings.

Click on your project in the Project Explorer, select Build Settings, locate Architectures section, and change the Build Active Architecture Only setting to Yes for Debug and No for Release.

Hope this will work for you.




回答5:


Without having the actual project, it is very difficult to tell what the problem is. However, you do have a problem with the code that you have written. This won't compile with the data/string/JSON variable being declared. That "may" be the actual problem. Please try the following and see if that helps.

Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"])          .response { request, response, data, error in              println(request)              println(response)              println(data)              println(error)          } 



回答6:


I found this answer and it worked for me:

I had the same problem after installing from cocoapods. Choosing Product | Clean then Product | Build fixed it. I selected my project name then the project then. - Clean Cmd+shit+K - Build Cmd+B Strangely enough this worked for me. Good Luck!



来源:https://stackoverflow.com/questions/28549832/module-alamofire-has-no-member-named-request

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