Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post string on Facebook wall without showing dialog (iPhone Facebook SDK)

I have been searching stackoverflow and the internet and did no find a working solution for my intention.

I want to call a method with a string as parameter which is then posted to the facebook wall without showing a dialog. Of course only when a valid session is available.

I tried this:

// post message to facebook pinnwall
- (void)postOnWall:(NSString *)message {

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: message, @"message",nil];
    [[FBRequest request] call:@"facebook.stream.publish" params:params];
}

Can you guys help me ou with a working method?

Thanks and cheers, doonot

like image 202
nimrod Avatar asked Mar 03 '11 17:03

nimrod


1 Answers

as Aby said, you have to look at the Graph API to user FB at its full potential.

simple code:

NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];

NSString *wallPost = @"the super wall post";
NSString *linkURL  = @"http://www.supersite.com";
NSString *imgURL   = @"http://www.supersite.com/image.jpg";

[fbArguments setObject:wallPost forKey:@"message"];
[fbArguments setObject:linkURL  forKey:@"link"];
[fbArguments setObject:imgURL   forKey:@"picture"];

[facebook requestWithGraphPath:@"me/feed" 
                    andParams:fbArguments
                andHttpMethod:@"POST"
                  andDelegate:self];
like image 152
teriiehina Avatar answered Sep 30 '22 02:09

teriiehina