I want to get someone's profile picture based on their objectID
which I have stored into a variable called userID
in my application. I have tried the following but it doesn't seem to display the picture:
FBRequestConnection.startWithGraphPath(objectID, completionHandler: { (connection, result, error) -> Void in
let url = NSURL(string: "http://ift.tt/1InoasS")
let urlRequest = NSURLRequest(URL: url!)
//Asynchronous request to display image
NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue()) { (response:NSURLResponse!, data:NSData!, error:NSError!) -> Void in
// Display the image
let image = UIImage(data: data)
let imageView = UIImageView(image: image)
cell.individualImage = imageView
}
})
Unfortunately nothing displays. I have noticed that you can use the FBRequestConnection.startForMeWithCompletionHandler
method and use the same code above to display the current user's profile picture which works fine but I want to display the profile picture based on object id I pass in, not just the current user's.
Aucun commentaire:
Enregistrer un commentaire