Giter Site home page Giter Site logo

rmfblayer's Introduction

RMFBLayer

RMFBLayer is a class to access the Facebook API within OS X applications by sending requests either using the OS X Facebook integration (if available) or PhFacebook.framework as fallback.

OS X Facebook integration (Social.framework) might not be available due to the fact that the user has not updated yet to OS X 10.8.2 or that the user has not set up the Facebook account in his System Preferences. The RMFBLayer automatically recognizes these circumstances and uses then PhFacebook.framework instead.

RMFBLayer provides a streamlined interface to the two Facebook API abstractions to facilitate the data retrieval. All requests are based on the completion block paradigm.

WARNING: Since PhFacebook.framework originally does not support completion blocks, a modified version is available as fork, separately.

Requirements:

  • You have added Social.framework to your app
  • You have added the PhFacebook.framework with completion block support

Details:

RMFBLayer provides an interface to quickly send requests and process their result. It does that by delegating the requests to abstractions. Currently, two abstraction intances are available:

  • RMFBOSX: The OS X Facebook integration,
  • RMFBPhFacebook: The PhFacebook framework Both abstractions, and the layer itself, share the same interface to access the Facebook API.

To make FQL requests, wrap them into a normal GET request.

Usage:

  1. Set the preferred abstraction and add the two abstractions:
	[[RMFBLayer sharedInstance] setPreferredFramework:RMFBFrameworkOSX];
	[[RMFBLayer sharedInstance] addAbstraction:[[RMFBOSX alloc] initWithFacebookAppId:kFacebookAppId]];
	[[RMFBLayer sharedInstance] addAbstraction:[[RMFBPhFacebook alloc] initWithFacebookAppId:kFacebookAppId]];
  1. Set the delegate in order to be notified once the auth has finished:
	[[RMFBLayer sharedInstance] setDelegate:self];
  1. Start the authentication:
	[[RMFBLayer sharedInstance] authForPermissions:@[@"read_mailbox"]];
  1. Make a new request:
	[[RMFBLayer sharedInstance] performGETRequest:@"/me" usingParameters:@{
		@"fields": @"id"
	} andCompletionHandler:^(NSObject *resultObject, NSError *error) {
		NSLog(@"Get request result: %@", resultObject);
		NSLog(@"Get request error: %@", error);
		NSString *identifier = [((NSDictionary *)resultObject) objectForKey:@"id"];
	}];

Status

Currently marked as BETA. PhFacebook usage has not been tested heavily.

Contact

License

Copyright (c) 2013 Raffael Hannemann Under BSD License.

Want more?

Follow @raffael_me for similar releases.

rmfblayer's People

Contributors

raffael avatar

Watchers

Tomasz Wojtkowiak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.