Reputation: 2104
I am working for an iOS app and I want to integrate Facebook sdk 3.1 for posting status on facebook but I really dont have any idea how to do it. Can anybody please provide me link to easy tutorials or step by step approach for how to do it.
Upvotes: 1
Views: 1750
Reputation: 2365
To set up your Xcode project, read the instructions on the Facebook developer site.
You can create / open a session using [FBSession openActiveSessionWithAllowLoginUI:YES];
To publish to your timeline, you'll need to authorise with write permissions:
[[FBSession activeSession] reauthorizeWithPublishPermissions:@[ @"publish_stream" ] defaultAudience:FBSessionDefaultAudienceEveryone completionHandler:^(FBSession *authSession, NSError *authError) {
// If auth was successful, create a status update FBRequest
if (!authError) {
FBRequest *postRequest = [FBRequest requestForPostStatusUpdate:@"Hello, world!"];
[postRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
// TODO: Check for success / failure here
}];
}
}];
Upvotes: 2
Reputation: 1979
Try this:
[FBRequestConnection startForPostStatusUpdate:@"I've been through the storm, future, present and past.. Light as a feather, swift as a cat.. Clickety clack, clickety clack!!" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSLog(@"posted");
}];
Hope this helps.
Upvotes: 1