I'm doing the scrumptios facebook developer tutorial for the 3.1 iOS SDK. I've managed to display my profile name from facebook, however the FBProfilePictureView wont show the picture
here's the code for iboutlet
@property (strong, nonatomic) IBOutlet FBProfilePictureView *useProfileImage;
here is what I used to display the pic
self.useProfileImage.profileID = user.id;
I have confirmed that the it changed the profileid variable of the image by displaying it in a label.
When I first ran the project I had this error
"2012-05-18 04:04:11.620 Scrumptious[6548:f803] Unknown class FBProfilePictureView in Interface Builder file."
and solved it they way the FB tutorial suggested- by adding [FBProfilePictureView class];
to "applicationdidfinishlaunching: withoptions" in the app delegate.
any idea why the picture wouldn't show?
Adding the
[FBProfilePictureView class];
as the first line in the app delegate method of didFinishLaunching seems kinda hacky to me.Check out the HelloFacebookSample inside the SDK. Here is the 4 line comment:
I tried adding the
-ObjC
flag and it worked fine.I had the same issue, xcode4.5.1 ios6. to fix do this: in IB uncheck use autolayout for FBprofilepictureview, also uncheck "autoresize subview" into the view
Classes that use categories to extend existing classes are not loaded automatically. Classes that are used from the Xcode interface builder aren't loaded automatically, for example when you add a FBLoginView to your interface by drawing a view in your .xib file and then classing it as FBLoginView from the interface builder UI.
class
helps to create a pointer to the FBProfilePictureView.I have the same problem. My solution is to uncheck the "Use autolayout" option in "File Inspector" of the xib file. To open the "File Inspector", press cmd+option+1 after opening the xib file.
Edit 1: Just find another solution.
Try to set a width constraint and height constraint to the profile picture view. I find this tutorial is useful.
As documented in the facebook webpages you need to put the [FBProfilePictureView class]; as the first line in the app delegate method of didFinishLaunching. (Note their sample code does not have this but still works, in my case it will not work without it.
I created a UIView object sized it up and then selected the class from UIView to FBProfilePictureView. This will disconnect any connection between your program and IB so you need to reconnect again, the error in which you are not able to see the picture is due to the object not being wired up to an IBOutlet item. I am not sure if a cut and paste will work, maybe it will, but I created the object from UIView and just changed the class manually through IB.
Without the [FBProfilePictureView class]; it will give you an error.
If done correctly, if you view the XIB - in the object window/list you should see "Profile Picture View"along with Button and Label instead of FBProfilePictureView. The profile pic from facebook should show.
They(fb developer forum) said paste that in your app delegate didLunch method like that
just replace
it will work magically :)