A message line on a Facebook wall without displaying a dialog box (iPhone Facebook SDK)

I searched stackoverflow and the internet and did not find a working solution for my intentions.

I want to call a method with a string as a parameter, which is then sent 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 with the working method?

Thanks and greetings, doonot

+4
source share
4 answers

as Abi said, you need to take a full look at the Graph API for the FB user.

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]; 
+9
source

Posted on Facebook Wall u must go through JSON

check it out delgates

 - (void)postToWall { FBStreamDialog *dialog =[[[FBStreamDialog alloc]init ]autorelease]; dialog.userMessagePrompt = @"Whats on your Mind about this Articles..."; dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"The Black Sheep: %@ Specials for %@, %@ \",\"href\":\"http://%@/\",\"caption\":\" %@ \",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"%@\",\"href\":\"http://www.raywenderlich.com/\"}]}", [[BarSplArr objectAtIndex:0]objectForKey:@"barname"],day,date,[[BarSplArr objectAtIndex:0]objectForKey:@"barwebsite"],[[BarSplArr objectAtIndex:0]objectForKey:@"drinkspecials"],[[BarSplArr objectAtIndex:0]objectForKey:@"barimage"]]; //dialog.actionLinks = @"[{\"text\":\"See My App here!\",\"href\":\"http://www.facebook.com/developers/apps.php?app_id=178257532217623&ret=2/\"}]"; [dialog show]; } 

Better you can follow this method. http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app

excellent tutorial

0
source

You tried to use the Graph API.
If you like when your application prints on the wall without user interaction, such as a dialog box, you can use the Graph API. http://developers.facebook.com/docs/reference/api/post/

0
source

NOTE. You must have permission to publish_actions, as well as process and verify the accessToken and the user is logged in or not.

 func postMessageOnFaceBookWall() { FBSDKGraphRequest(graphPath: "me/feed", parameters: ["message": "Hello my test post"], httpMethod: "POST").start { (connection, result, error) in if error == nil{ //Handle your response here } else{ // error } } } 
0
source

Source: https://habr.com/ru/post/1342160/


All Articles