Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An open-source iOS library to simply retrieve images from Facebook, Flickr, Instagram, Picasa, ...

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

GrabKit

GrabKit is an iOS Objective-C library offering simple and unified methods to retrieve photo albums on Facebook, Flickr, Picasa, iPhone/iPad and Instagram (and more to come...)

Abstract

In your iPhone/iPad applications, you may want to let your users access their photo albums hosted on various social networks like Facebook or FlickR, or stored in the device. Unfortunately, the websites hosting these images offer different APIs and different libraries to authentify a user, grab its photo albums, etc.

GrabKit is made to wrap these differences into a simple library. Retrieve photo albums the same way for Facebook, FlickR, or any other implemented service !

So far, GrabKit supports :

  • Facebook
  • FlickR
  • Instagram
  • Picasa
  • iPhone/iPad

GrabKit is an ARC project.

Screenshots of the Demo application

screenshot of the demo application

Quick Examples

First example : retrieve 10 albums on user's Facebook account.

#import "GRKFacebookGrabber.h"

// create a grabber for Facebook
GRKFacebookGrabber * grabber = [[GRKFacebookGrabber alloc] init];

// Do you prefer a grabber for Picasa or FlickR ? simply create a GRKPicasaGrabber or a GRKFlickrGrabber.
// the following code would still work.

// Connect the grabber. the user will be prompted in Safari to authenticate and return to the app.
[grabber connectWithConnectionIsCompleteBlock:^(BOOL connected){

    if ( connected ){

        // ask for the first 10 albums of the user.
        [grabber albumsOfCurrentUserAtPageIndex:0 withNumberOfAlbumsPerPage:10 andCompleteBlock:^(NSArray *albums) {

            // albums is an NSArray of GRKAlbum, containing the 10 first albums of the user on Facebook.

        } andErrorBlock:^(NSError *error) {

            // Oop's, an error occured :)
        }];
    }

}];

Second example : Fill an album with its 10 first photos

GRKAlbum * firstAlbum = [albums objectAtIndex:0];

[grabber fillAlbum:firstAlbum withPhotosAtPageIndex:0 withNumberOfPhotosPerPage:10 andCompleteBlock:^(NSArray *addedPhotos) {

     // At this point, firstAlbum is filled with its 10 first photos, and the added photos are passed in the NSArray addedPhotos

      NSLog(@" already loaded photos of first album : %@", [firstAlbum photos]);
      NSLog(@" added photos : %@", addedPhotos);


  } andErrorBlock:^(NSError *error) {
      // Oop's, an error occured :)
  }] ;

Features

Grabkit allows you to grab these photo albums for the following services :

  • Facebook
  • FlickR
  • Picasa
  • Instagram
  • iPhone/iPad

Model

  • an album is an instance of a GRKAlbum, having the following properties :

    • albumId : id of the album according to the service
    • count : total number of photos for the album, according to the service.
    • name : nome of the album
  • a photo is an instance of a GRKPhoto. It has a name (title of the photo), a caption(its description). A GRKPhoto has several images which represent the photo in different sizes.

  • an image is an instance of GRKImage. it has a width, a height, an URL, and a flag (isOriginal) notifying if this image is the original image uploaded by the user.

How To Use GrabKit

The demo application included in the project is ready to use.

To use GrabKit in your own applications, there are two steps :

  • The installation, described in the wiki here
  • The configuration

Configuration

In order to grab content from each service, you need to register your app and get an API key from each service

Facebook :

  • go to https://developers.facebook.com/apps/ and click on "+ Create new app"
  • enter a name for your app, and proceed
  • Once you have completed the process, you'll access the page of your app. It shows an App Id : that's what we need.

  • Open your application's App-Info.plist and in "URL Types" -> "item N" -> "URL Schemes", add "fb" + your App Id (like "fb350975928312519" for example)

  • Report your App Id into your configurator file, in the method facebookAppId

Instagram :

  • go to http://instagram.com/developer/clients/register/
  • fill the form. In the "OAuth redirect_uri" field, enter a lowercase url like "mygreatapplication://".
  • Report your Client ID and your Redirect URI into your configurator file, respectively in the methods instagramAppId and instagramRedirectUri
  • Open your application's App-Info.plist and in "URL Types" -> "item N" -> "URL Schemes", add your redirect URI (without the "://")

FlickR :

  • go to http://www.flickr.com/services/apps/create/apply/ and choose the kind of key you want (Commercial or non-commercial)
  • Process the form and report your Api Key and your Api Secret into your configurator file, in the methods flickrApiKey and flickrApiSecret.
  • Click on "Edit auth flow for this app",
    • in App type, select "web application" (yes, web application ;))
    • in Callback URL, add a custom and unique url, like "mygreatappusinggrabkit://" or "flickr"+your app id+"://" Report your callback url into your configurator file in the method flickrRedirectUri
    • Open your application's App-Info.plist and in "URL Types" -> "item N" -> "URL Schemes", add your redirect URI (without the "://")

Picasa :

  • go to https://code.google.com/apis/console/
    If you have never used Google APIs console before, click on "Create project". A default project named "API Project" is created

  • Select your project, go to the "API Access" item, and click on "Create an OAUth 2.0 client ID ..."

  • Enter your application's name and other informations if you need
  • in Application type, select "Installed application"
  • in "Installed application type", select "other" (don't select "iOS", it's buggy ...)
  • Report your Client ID and Client secret into your configurator file in the methods picasaClientId and picasaClientSecret.

Coming soon

  • More tests and examples
  • More services
  • More documentation
  • More content to grab
  • Changes for iOS6

Feel free to help and contribute :)

Changelog

GrabKit v1.1 changelog :

  • Project re-organized : 1 project, 3 targets : demo application, static library and bundle.
  • GrabKit is ARC
  • GrabKit uses Facebook iOS SDK 3.0
  • Update in the Instagram grabber to use NSJSONSerialization (no need of SBJSon anymore)
  • Fix in the FlickR Grabber for connection
  • Fix in the Picasa Grabber related to Gdata lib's intern cache mechanism
  • Update in connectors to allow canceling connections
  • Adding a configuration protocol (GRKConfiguratorProtocol)
  • Udpate in demo :
    • Fix to make GRKDeviceGrabber work
    • In the list of photos, each page of result is now a TableView section
    • A logout button is now available
    • Icons for each service

GrabKit v1.0 changelog :

  • Initial version, non ARC, with the following grabbers:
    • Facebook
    • FlickR
    • Instagram
    • Picasa
    • iPhone/iPad

License

This project is under MIT License, please feel free to contribute and use it.

The Facebook Grabber uses :

The FlickR Grabber uses the ObjectiveFlickR project : https://github.com/lukhnos/objectiveflickr

The Picasa Grabber uses "Google Data APIs Objective-C Client Library" : https://code.google.com/p/gdata-objectivec-client/

Contact

Are you using GrabKit in your project ? Do you have a suggestion ? Any question ?

Pierre-Olivier Simonard

pierre.olivier.simonard@gmail.com

www.twitter.com/pierrotsmnrd

Something went wrong with that request. Please try again.