Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all you read this article published from Facebook developers</p> <p><a href="http://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/" rel="nofollow">http://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/</a></p> <p>in step 1 it will also work for xcode 4.3 </p> <p>you carefully read all steps one by one n implement </p> <p>In step6 you write code as follow on where Facebook Btn Pressed</p> <pre><code> - (IBAction)facebookBtnPressed:(id)sender { // if it is available to us, we will post using the native dialog BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self initialText:[NSString stringWithFormat:@"Here U write code which u want to post on facebook"] image:[UIImage imageNamed:@"1.jpg"] url:[NSURL URLWithString:@""] handler:nil]; if (!displayedNativeDialog) { NSString *shareStr = [NSString stringWithFormat:@"Here U write code which u want to post on facebook"]; NSMutableDictionary* params = [[NSMutableDictionary alloc] initWithObjectsAndKeys: shareStr,@"description", @"sharelink", @"link", @"ImageName", @"picture", nil]; [self performPublishAction:^{ [FBRequestConnection startWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if (error) { NSLog(@"error in post"); } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Post Successfully" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } }]; }]; } //} //===set delagate in Viewcontroller.h of mySLComposerSheet [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) { NSString *output; switch (result) { case SLComposeViewControllerResultCancelled: output = @"Action Cancelled"; break; case SLComposeViewControllerResultDone: output = @"Post Successfully"; break; default: break; } //check if everything worked properly. Give out a message on the state. UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }]; } - (void) performPublishAction:(void (^)(void)) action { if ([[FBSession activeSession]isOpen]) { /* * if the current session has no publish permission we need to reauthorize */ if ([[[FBSession activeSession]permissions]indexOfObject:@"publish_actions"] == NSNotFound) { [[FBSession activeSession] reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"] defaultAudience:FBSessionDefaultAudienceOnlyMe completionHandler:^(FBSession *session, NSError *error) { action(); }]; }else{ action(); } }else{ /* * open a new session with publish permission */ [FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"] defaultAudience:FBSessionDefaultAudienceOnlyMe allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { if (!error &amp;&amp; status == FBSessionStateOpen) { action(); }else{ NSLog(@"error"); } }]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload