Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBProfilePictureView object won't show image

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?

link to the tutorial

like image 334
Yoav Schwartz Avatar asked Nov 13 '12 16:11

Yoav Schwartz


2 Answers

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:

// If you have not added the -ObjC linker flag, you may need to uncomment the following line because
// Nib files require the type to have been loaded before they can do the wireup successfully.
// http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime
// [FBProfilePictureView class];

I tried adding the -ObjC flag and it worked fine.

like image 144
Chris Savory Avatar answered Oct 10 '22 06:10

Chris Savory


To resolve this, add this as the first line in the app delegate's application:didFinishLaunchingWithOptions: method:

[FBProfilePictureView class];

like image 45
Asa Guo Avatar answered Oct 10 '22 06:10

Asa Guo