I am using Almofire through Swift Package Manager
(SPM) and also imported it by import Alamofire
. While I am trying to make a network request using AF
, it gives me following error:
Asked
Active
Viewed 1,449 times
2

NSPratik
- 4,714
- 7
- 51
- 81
1 Answers
5
In your Swift Package Dependencies seems that you are using Alamofire 4.9.1 and, if i'm not wrong, AF namespace is used from Alamofire 5. So you can switch to Alamofire 5 or change
AF.request("url..")...
to
Alamofire.request("url..")...

Alessandro
- 2,927
- 1
- 10
- 14
-
1Upvoted..I checked it and it is working fine. Why it is version 4.9.1? I just downloaded dependency through Swift package manager an hour ago.. – NSPratik Dec 18 '19 at 08:23
-
1I think that SPM downloaded 4.9.1 version because 5 is still beta. If you want to download that version, you should specified it. If my answer is correct please, mark it as correct. Thank you – Alessandro Dec 18 '19 at 08:28
-
1If you can answer, can you tell me how can I use `.Validate()` of Almofire in best way? e.g. .`validate(statusCode: 200..<300)` or something else – NSPratik Dec 18 '19 at 08:31
-
Check if this my answer to another post can help you https://stackoverflow.com/a/45105730/4205097 – Alessandro Dec 18 '19 at 08:32