Latest 0.6.0
License Apache License, Version 2.0 (
Platforms ios 7.1, requires ARC
Dependencies AFNetworking, Facebook-iOS-SDK
Frameworks UIKit

[CI Status]( Miller/SMFBProfileImageView)


  • Just as simple as using the FBProfilePictureView class.
  • Uses the AFNetworking library to manage image downloads making it easy to add additional control.
  • Fixes an issue that FBProfilePictureView has when used in a tableview. See FBProfilePictureView in UITableView below.

FBProfilePictureView in UITableView

The original FBProfilePictureView has an issue where images in a UITableView will not be set until scrolling is stopped.


This is caused by scheduling the connection handler block to run in the default run loop mode. Therefore, the connection handler block, which sets the image, is not run until scrolling is completed. The fix, which AFNetworking does by default, is to set the runloop mode to NSRunLoopCommonModes when scheduling the connection handler. You can see the difference it makes with SMFBProfileImageView in UITableView below.

SMFBProfileImageView in UITableView


The Example Project

To run the example project, clone the repo, and run pod install from the Example directory first.

You can simply run the application and you will be presented with a screen to enter a Facebook user ID, you can find your own by using the Facebook Graph Explorer tool. If you have having an issue with images loading, read Setting the Access Token below.

Setting the Access Token

You can easily set a Facebook access token for the access token. Just copy a temporary access token (you can just copy the one provided by Facebook Graph Explorer tool). Then find SMViewController.h in the example project and find the section of code:

/* UNCOMMENT TO USE YOUR OWN ACCESS TOKEN (you can use a temporary one
 * from
//#define kAccessToken @""

Uncomment the define line and paste the access token between the quotes so it looks like this:

#define kAccessToken @"<your access token>"

Now when running the example app, the access token you added will be used to quary Facebook and should allow you to view all public images and all the pictures in the list example.


This class is based off of FBProfilePictureView provided with the Facebook-iOS-SDK and will attempt to maintain the same API as descibed in the Facebook iOS SDK docs.

Basic usage

The following code creates a SMFBProfileImageView instance with a users facebook ID. This will automatically load the users profile picture and display the FB placeholder image while loading.

SMFBProfileImageView *profileImageView = [[SMFBProfileImageView alloc] initWithProfileID:@"<profile id>"

You can also create an instance of the view without profile ID or picture cropping and set those properties later.

// Method 1 - Use default initializer with nil ID
SMFBProfileImageView *profileImageView = [[SMFBProfileImageView alloc] initWithProfileID:nil
profileImageView.profileID = @"<facebook user ID>";

// Method 2 - Create profileImageView and set all properties later
SMFBProfileImageView *profileImageView2 = [SMFBProfileImageView new];
profileImageView2.profileID = @"<facebook user ID>";
profileImageView2.pictureCropping = FBProfilePictureCroppingOriginal;

Added Functionality to FBProfilePictureView

By default, SMFBProfileImageView instances use Facebook’s graph api version 2.2 and attempts to use a Facebook access token from the Facebook SDK [FBSession activeSession]. This behavior can be modified by setting the API version to use or setting the access token to use.

SMFBProfileImageView *profileImageView = [SMFBProfileImageView new];
profileImageView.pictureCropping = FBProfilePictureCroppingOriginal;

// Set the API version to use
profileImageView.graphVersion = @"2.0";

// Set the access token to use
profileImageView.accessToken = @"<access token";

// When specifying version and/or access token to use, must set profileID afterwards
// to ensure using the new access token and version.
profileImageView.profileID = @"<facebook user ID>";

To make an instance use the access token from [FBSession activeSession] after explicitly setting the access token:

profileImageView.accessToken = nil;


In order to load every profile photo, it may be necessary to use a Facebook access token. This will require following the Facebook Getting Started Guide to get an App ID and opening a session in the app. Once a FB session is open in your application, SMFBProfileImageView should work as expected.


SMFBProfileImageView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SMFBProfileImageView", "0.6.0"

Change Log


  • Changed image loading to use the UIImageView+AFNetworking category for dedicated image loading support.


  • Initial public release


Sam Miller, [email protected]


SMFBProfileImageView is available under the Apache 2.0 license. See the LICENSE file for more info.

Latest podspec

    "name": "SMFBProfileImageView",
    "version": "0.6.0",
    "summary": "A replacement class for FBProfilePictureView part of the Facebook iOS SDK.",
    "description": "                       Provides a simple and convient way to display profilentt       ntt       **Features in addition to FBProfilePictureView**n                       * Uses AFNetworking to download images and provide cachingntt       * Fixes an issue with use in a UITableView where images wont update while scrollingn",
    "homepage": "",
    "license": {
        "type": "Apache License, Version 2.0 (",
        "file": "LICENSE"
    "authors": {
        "Sam Miller": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.6.0"
    "platforms": {
        "ios": "7.1"
    "requires_arc": true,
    "source_files": [
    "frameworks": "UIKit",
    "dependencies": {
        "AFNetworking": [
            "~> 2.3"
        "Facebook-iOS-SDK": [
            "~> 3.22"

Pin It on Pinterest

Share This