0

I'm having the same problem I saw some people have with the FBProfilePictureView not showing the photo. I've already seen this question and I've added

[FBProfilePictureView class];

to my first line of the app delegate method didFinishLaunching but that did not solve.

Sometimes it loads all images, sometimes it loads most of them and sometimes only a few images.

I create the FBProfilePictureView programmatically doing:

FBProfilePictureView *friendProfilePic = [[FBProfilePictureView alloc] init];

friendProfilePic.profileID = friendID; //friendID is a NSString I've created before

friendProfilePic.frame = CGRectMake(xPos, yPos, width, height);

Does anyone know what might be happening?

Note: I didn't want to use -ObjC linker flag because it will raise my app size

Note2: I can't comment on questions so I had to make another one.

Thanks

Community
  • 1
  • 1
fe-a-v
  • 3
  • 2

2 Answers2

1

If it is loading some images then it is not related to the ObjC linker flag. It is likely some of the requests are failing. I created a replacement for FBProfilePictureView that reports errors. Add it to your project and change your code to:

DBFBProfilePictureView *friendProfilePic = [[DBFBProfilePictureView alloc] initWithFrame:CGRectMake(xPos, yPos, width, height)];
friendProfilePic.profileID = friendID;
friendProfilePic.completionHandler = ^(DBFBProfilePictureView* view, NSError* error){
        if(error) {
            view.showEmptyImage = YES;
            view.profileID = nil;
            NSLog(@"Loading profile picture failed with error: %@", error);
        } 
    };

and you will see any errors logged to the console.

fe-a-v
  • 3
  • 2
combinatorial
  • 9,132
  • 4
  • 40
  • 58
  • I appreciate your help with this replacement but I would like to make it work with the existing code! Do you know what kind of erros might be happening? Thanks – fe-a-v Nov 18 '14 at 02:30
  • I'm sorry I don't... I might guess that you are trying to ask for too many and some of the network requests are failing. You can try this class, see what the errors are and then switch back. – combinatorial Nov 18 '14 at 02:38
0

Did you add the ProfilePic to your view?

Get the main view, and add the profilepic as a subview to it.

[myMainView addSubView: friendProfilePic]
gdbj
  • 16,102
  • 5
  • 35
  • 47