Reputation: 545
So I'm trying to create a simple scrolling bar of pages a user likes, with the image and name displayed. However, the profile view shows a blank image, not a placeholder picture, which means that it's receiving an image to display. After placing some break points in the actual FBSDKProfilePictureView code, specifically at _updateImageWithData:state:
, it's showing that for each image the data object is only 97 bytes. The funny thing is, when I so something like create a standalone profile picture view, like
FBSDKProfilePictureView *profilePictureView = [[FBSDKProfilePictureView alloc] initWithFrame:CGRectMake(inset, inset, profileSize, profileSize)];
profilePictureView.profileID = @"4"; //Mark Zuckerberg's id
it displays the image properly.
So at first I thought it might have been something to do with setting too many profile ids, thus creating too many url requests, but if I just ran the code below once (i.e. no loop) it still returns the same 97 bytes.
Below is the code I use to generate the scroll view.
for (int i = 0; i < numToIterate; i++) {
NSDictionary *curr = [sharedInterests objectAtIndex:i];
NSString *idNumber = [curr objectForKey:@"id"];
NSString *name = [curr objectForKey:@"name"];
NSLog(@"getting %@, %@.", name, idNumber);
// get logo
FBSDKProfilePictureView *itemView = [[FBSDKProfilePictureView alloc] initWithFrame:CGRectMake(i * (smallFrameWidth + horizontalBufferBetweenPics) + horizontalBufferBetweenPics, 0, smallFrameWidth,smallFrameHeight)];
[self.scrollView addSubview:itemView];
[itemView setProfileID:idNumber];
// create description
UILabel *currDescriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(i * (smallFrameWidth + horizontalBufferBetweenPics) + horizontalBufferBetweenPics, smallFrameHeight, categoryLabelWidth, categoryLabelHeight)];
currDescriptionLabel.text = name;
currDescriptionLabel.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.5];
currDescriptionLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12];
currDescriptionLabel.textAlignment = NSTextAlignmentCenter;
currDescriptionLabel.numberOfLines = 2;
[scrollView addSubview:currDescriptionLabel];
}
Upvotes: 2
Views: 607
Reputation: 9561
I created a modified version of FBProfilePictureView that provides error reporting. It allows you to set a completion handler where errors are reported:
self.facebookPictureView.completionHandler = ^(DBFBProfilePictureView* view, NSError* error){
if(error) {
view.showEmptyImage = YES;
view.profileID = nil;
NSLog(@"Loading profile picture failed with error: %@", error);
}
}
Upvotes: 1