How to create facebook album through iOS app


1.Requirement

i) facebook accessToken

2.Code

-(void)createFbAlbumwithName:(NSString *)AlbumName andId:(NSString *)bubbleId{

NSString *token=[[NSUserDefaults standardUserDefaults] objectForKey:@”fb_access_token”];

if(token==nil){

[self alertForfacebookAlbum:@”Your account not connected to facebook.” withActionTitle:@”Cancel”];

return;

}

NSMutableDictionary *paramsToCreateAlbum = [NSMutableDictionary dictionaryWithObjectsAndKeys:

                                               AlbumName, @”name”,

[NSString stringWithFormat:@”This album is created by YourApp app for Event ‘%@'”,AlbumName], @”message”,token,@”access_token”, nil];

[FBRequestConnection startWithGraphPath: @”me/albums”

parameters: paramsToCreateAlbum

HTTPMethod: @”POST”

completionHandler: ^(FBRequestConnection *connection,

id result,

NSError *error) {

if (!error) {

//publish content to albumID

NSLog(@”album key is %@”,[result objectForKey:@”id”]);

facebookAlbumId=[result objectForKey:@”id”];

//

}

else {

NSLog(@”error: %@”, error);

[self alertForfacebookAlbum:@”Error in creating facebook album” withActionTitle:@”Retry”];

}

                          }]; }

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: