LauGrrcia
LauGrrcia

Reputation: 11

Alamofire.request() errors out in Xcode 12

I have a networking method using alamofire called getPriceData(), and inside of it an Alamofire.request(url, method: .get) that errors out twice, although this same method is used in another app project exactly the same and works fine. The errors:

Module 'Alamofire' has no member named 'request'

Cannot infer contextual base in reference to member 'get'

The method:

 func getPriceData(url: String) {
    Alamofire.request(url, method: .get).responseJSON {
        response in
        if response.result.isSuccess {
            let priceJSON: JSON = JSON(response.result.value!)
            self.updatePriceData(json: bitcoinJSON)
        } else {
            self.bitcoinPriceLabel.text = "N/A"
        }
    }
}

Here's a screenshot of the chunk of code and the two errors: The method and the errors

Upvotes: 1

Views: 1028

Answers (1)

Shivam Parmar
Shivam Parmar

Reputation: 1570

try this may be it will work for you :)

AF.request(url,method: .get).responseString{
                        responce in
                     }

Upvotes: 2

Related Questions