Unable to get image from foursquare api, on fast iOS

I use das quadrat foursquare sdk for fast (QuadratTouch) everything works fine expect to receive images they were marked in JSON as NSDictionary with "prefix" and "suffix", and UIImage get zero at the end

Parsing JSON and creating a normal URL

let parameters = [Parameter.ll:"\(lat),\(long)", Parameter.limit:"35", Parameter.radius:"\(radius)", Parameter.intent:"browse"]
    let currentTask = session.venues.search(parameters) {
        (result) -> Void in
        var places = [Place]()
        if let response = result.response {
            if let venues =  response["venues"] as? NSArray {
                for venue in venues {
                    if let categories = venue["categories"] as? NSArray {
                       let categoryInfo = categories[0] as! NSDictionary
                              if let  location = venue["location"] as? NSDictionary,
                                name = categoryInfo["name"] as? String,
                                address = location["address"] as? String,
                                lat = location["lat"] as? CLLocationDegrees,
                                long = location["lng"] as? CLLocationDegrees,
                                icon = categoryInfo["icon"] as? NSDictionary,
                                prefix = icon["prefix"] as? String,
                                suffix = icon["suffix"] as? String {
                                    let url = prefix + suffix
                                    let pos = CLLocationCoordinate2DMake(lat, long)
                                    places.append(FourSquarePlace(coordinates: pos, title: name, address: address, imageURL:url, photo: nil))
                            }

and method for obtaining images from SessionAuthorizationDelegate

 self.session.downloadImageAtURL(NSURL(string: imageURL)!, completionHandler: { (imageData, error) -> Void in
                    //print(imageData)
                    print(imageURL)
                    if imageData != nil {
                        thisMarker.icon = UIImage(data: imageData!)
                    }
                })

I tried to insert the ULR from my son into the browser and got it

AccessDeniedAccess DeniedAF1DF956303F2D6EcRetLqGf3ipb6KOsSJ9YkqiDnmEUkjhEavefWCzjlHQAivKWMLsRMQukWsYiVCYK

It may not be able to add an access token to the image, but its a strange reason: I use the sdk method ...

+4
source share
1 answer

let url = prefix + suffix

. .

.

url = + "100x100" +

. API Foursquare

URL- , + + , . https://irs0.4sqi.net/img/general/300x500/2341723_vt1Kr-SfmRmdge-M7b4KNgX2_PHElyVbYL65pMnxEQw.jpg.

, XX YY 36, 100, 300 500.

  • XXxYY
  • :
  • capXX: XX ( , ). , -
  • widX: XX
  • heightYY: YY
+2

Source: https://habr.com/ru/post/1610000/


All Articles