SCFacebook
The SCFacebook 4.1 is a simple and cleaner to use the api facebook-ios-sdk Objective-C Wrapper (https://github.com/facebook/facebook-ios-sdk) to perform login, get friends list, information about the user and posting on the wall with ^Block for iPhone. Suporte 4.71 FBSDKCoreKit, FBSDKShareKit and FBSDKLoginKit. Facebook SDK
Install / Use
/learn @lucascorrea/SCFacebookREADME
Facebook SDK 4.71 for iOS
Graph API Version v2.12
FBSDKCoreKit
FBSDKShareKit
FBSDKLoginKit
Demo

Installation
Before you need to follow the guide to begin using Facebook SDK for iOS - Getting Started with the Facebook iOS SDK
Getting Started
Using CocoaPods to get start, you can add following line to your Podfile:
pod 'SCFacebook'
Once you have set up the URL Scheme and FacebookAppID as image below:
)
IOS 9 is required this add fields like the image below:

Now in it's AppDelegate need to add one method and add permissions
#import <SCFacebook/SCFacebook.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/**
Init SCFacebook
Add the necessary permissions
If your app asks for more than than public_profile and email, it will require review by Facebook before your app can be used by people other than the app's developers.
The time to review your app is usually about 7 business days. Some extra-sensitive permissions, as noted below, can take up to 14 business days.
https://developers.facebook.com/docs/facebook-login/permissions/review
**/
[SCFacebook initWithReadPermissions:@[@"user_about_me",
@"user_birthday",
@"email",
@"user_photos",
@"user_events",
@"user_friends",
@"user_videos",
@"public_profile"]
publishPermissions:@[@"manage_pages",
@"publish_actions",
@"publish_pages"]
];
[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
return [[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
}
#pragma mark -
#pragma mark - SCFacebook Handle
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
Example Usage
To use the component is very easy. Import the header for your class.
#import <SCFacebook/SCFacebook.h>
@implementation ViewController
#pragma mark - Button Action
- (IBAction)login:(id)sender {
[SCFacebook loginCallBack:^(BOOL success, id result) {
if (success) {
}
}];
}
- (IBAction)publishYourWallLink:(id)sender {
[SCFacebook feedPostWithLinkPath:@"http://www.lucascorrea.com" caption:@"Portfolio" callBack:^(BOOL success, id result) {
if (success) {
}
}];
}
- (IBAction)publishYourWallMessage:(id)sender {
[SCFacebook feedPostWithMessage:@"This is message" callBack:^(BOOL success, id result) {
if (success) {
}
}];
}
Methods
When a person logs into your app via Facebook Login you can access a subset of that person's data stored on Facebook. Permissions are how you ask someone if you can access that data. A person's privacy settings combined with what you ask for will determine what you can access. Permissions are strings that are passed along with a login request or an API call. Here are two examples of permissions: email - Access to a person's primary email address. user_likes - Access to the list of things a person likes. https://developers.facebook.com/docs/facebook-login/permissions/v2.4 @param permissions
+ (void)initWithReadPermissions:(NSArray *)readPermissions publishPermissions:(NSArray *)publishPermissions;
Checks if there is an open session, if it is not checked if a token is created and returned there to validate session. @return BOOL
+ (BOOL)isSessionValid;
Facebook login https://developers.facebook.com/docs/ios/graph @param callBack (BOOL success, id result)
+ (void)loginCallBack:(SCFacebookCallback)callBack;
Facebook login https://developers.facebook.com/docs/ios/graph @param FBSDKLoginBehavior behavior @param callBack (BOOL success, id result)
+ (void)loginWithBehavior:(FBSDKLoginBehavior)behavior CallBack:(SCFacebookCallback)callBack;
Facebook logout https://developers.facebook.com/docs/ios/graph @param callBack (BOOL success, id result)
+ (void)logoutCallBack:(SCFacebookCallback)callBack;
Get the data from the logged in user by passing the fields. https://developers.facebook.com/docs/facebook-login/permissions/v2.12#reference-public_profile Permissions required: public_profile... @param callBack (BOOL success, id result)
+ (void)getUserFields:(NSString *)fields callBack:(SCFacebookCallback)callBack;
This will only return any friends who have used (via Facebook Login) the app making the request. If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person. 1 - get the User's friends who have installed the app making the query 2 - get the User's total number of friends (including those who have not installed the app making the query) https://developers.facebook.com/docs/graph-api/reference/v2.12/user/friends/ Permissions required: user_friends @param fields fields example: id, name, email, birthday, about, picture @param callBack (BOOL success, id result)
+ (void)getUserFriendsWithFields:(NSString *)fields callBack:(SCFacebookCallback)callBack;
This will only return any friends who have used (via Facebook Login) the app making the request. If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person. https://developers.facebook.com/docs/graph-api/reference/v2.12/user/friends/ Permissions required: user_friends @param callBack (BOOL success, id result)
+ (void)getUserFriendsCallBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("getUserFriendsCallBack has been replaced with getUserFriendsWithFields:callBack")));
Post in the user profile with link and caption https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed Permissions required: publish_actions @param url NSString @param caption NSString @param callBack (BOOL success, id result)
+ (void)feedPostWithLinkPath:(NSString *)url caption:(NSString *)caption callBack:(SCFacebookCallback)callBack;
Post in the user profile with message https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed Permissions required: publish_actions @param message NSString @param callBack (BOOL success, id result)
+ (void)feedPostWithMessage:(NSString *)message callBack:(SCFacebookCallback)callBack;
Post in the user profile with photo and caption https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed Permissions required: publish_actions @param photo UIImage @param caption NSString @param callBack (BOOL success, id result)
+ (void)feedPostWithPhoto:(UIImage *)photo caption:(NSString *)caption callBack:(SCFacebookCallback)callBack;
Post in the user profile with video, title and description https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed Permissions required: publish_actions @param videoData NSData @param title NSString @param description NSString @param callBack (BOOL success, id result)
+ (void)feedPostWithVideo:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack;
The feed of posts (including status updates) and links published by this person, or by others on this person's profile. https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed Permissions required: read_stream @param callBack (BOOL success, id result)
+ (void)myFeedCallBack:(SCFacebookCallback)callBack;
Invite friends with message via dialog https://developers.facebook.com/docs/graph-api/reference/v2.12/user/ @param appLink URL @param preview URL optional @param callBack (BOOL success, id result)
+ (void)inviteFriendsWithAppLinkURL:(NSURL *)url previewImageURL:(NSURL *)preview callBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("App Invites no longer supported")));
Get pages in user https://developers.facebook.com/docs/graph-api/reference/v2.12/page Permissions required: manage_pages @param callBack (BOOL success, id result)
+ (void)getPagesCallBack:(SCFacebookCallback)callBack;
Get page with id Facebook Web address ou pageId Example http://www.lucascorrea.com/PageId.png https://developers.facebook.com/docs/graph-api/reference/v2.12/page Permissions required: manage_pages @param pageId Facebook Web address ou pageId @param callBack (BOOL success, id result)
+ (void)getPageById:(NSString *)pageId callBack:(SCFacebookCallback)callBack;
Post in the page profile with message https://developers.facebook.com/docs/graph-api/reference/v2.
