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(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 ...
source
share