Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

publishing on my facebook wall using new sdk

I am using the new Facebook SDK to publish on my wall by following their instructions

I got authorization from the app, but when i try to publish i am getting an error Error: HTTP status code: 400 below i am posting my code

 - (void)viewDidLoad
{
self.postParams =
 [[NSMutableDictionary alloc] initWithObjectsAndKeys:
 @"https://developers.facebook.com/ios", @"link",
 @"https://developers.facebook.com/attachment/iossdk_logo.png", @"picture",
 @"Facebook SDK for iOS", @"name",
 @"build apps.", @"caption",
 @"testing for my app.", @"description",
 nil]; 

[self.postParams setObject:@"hgshsghhgsls" forKey:@"message"];

[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

-(IBAction)Post{
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate openSessionWithAllowLoginUI:YES];


[FBRequestConnection   startWithGraphPath:@"me/Mac" parameters:self.postParams HTTPMethod:@"POST"
                        completionHandler:^(FBRequestConnection *connection,id result,NSError *error) {
                            NSString *alertText;
                             if (error) {
                             alertText = [NSString stringWithFormat:@"error: domain = %@, code = %d, des = %d",error.domain, error.code,error.description];
                             } 
                             else 
                             {
                             alertText = [NSString stringWithFormat:@"Posted action, id: %@",[result objectForKey:@"id"]];
                             }
                             // Show the result in an alert
                             [[[UIAlertView alloc] initWithTitle:@"Result" message:alertText delegate:self cancelButtonTitle:@"OK!"
                             otherButtonTitles:nil]show];
                        }]; 




}

What am i doing wrong here and any suggestion will be great and this new SDK is a beta version ? or a complete one ?

like image 877
Ghouse Avatar asked Aug 30 '12 09:08

Ghouse


People also ask

What SDK does Facebook use?

To learn more about using Facebook development tools, see App Development. The current version of the Facebook SDK for Android is version 14.1. 1 and requires the Android API 15. Code and samples for the Facebook SDK for Android are available on GitHub.

How can I post on Facebook using Java?

android" should now be listed as a package. Copy one of the included Facebook icons to your app's "drawable" folder and refresh that as well. Eclipse will complain about the "FbDialog. java" file... just add an import pointing to your app's "R" file to the header of that file (e.g. if your app's package name is "com.


1 Answers

If you run into any issues, try turning on logging by adding this code before the request call you're interested in debugging:

[FBSettings setLoggingBehavior:[NSSet setWithObjects:FBLoggingBehaviorFBRequests, FBLoggingBehaviorFBURLConnections, nil]];

like image 188
user1682662 Avatar answered Nov 15 '22 22:11

user1682662