0

Well i have this problem! Im trying to make an app that when loading it the first time uses the FB profile picture.

But they can change the image later.

Now im trying to use the FBProfilePictureView view this whole time.

And try to convert it to Swift. It didn't work as planned.

 let imageURL = NSURL(string: img.valueForKey("url") as String)
        Alamofire.request(.GET, imageURL!).response() {
            (_, _, data, _) in

            let image = UIImage(data: data! as NSData)
            for obj in self.fb_background.subviews{

                if(obj.isKindOfClass(UIImageView)){

                    obj.image = image
                }
            }

This doesn't work the obj isn't recouldnised as an UIImageView

How can i get it to work?

Twizzler
  • 491
  • 1
  • 7
  • 25
  • [FBProfilePictureVIew](https://developers.facebook.com/docs/reference/ios/current/class/FBProfilePictureView) is a subclass of UIView. So when you introspect it in your `self.fb_background.subviews` view array with an `UIImageView`, it actually false. – Vinh Nguyen Jan 28 '15 at 15:07

1 Answers1

0

If you want to display Facebook avatar, just provide an profileID string to an FBProfilePictureVIew.

Vinh Nguyen
  • 816
  • 1
  • 13
  • 27