Share this to


  1. JonathanDec 10, 2012 at 11:31 pmReply


    Thank you. But how does facebook sharing works?

    My app requires ios 6, would that work with the native facebook share (like twitter for ios 5)?


    • adminDec 11, 2012 at 10:24 amReplyAuthor

      I will update you soon. It should be possible however I could not see any framework which support that in the new xcode update.

  2. JonathanDec 11, 2012 at 5:38 pmReply

    I think you need to install the Facebook SDK : https://developers.facebook.com/docs/howtos/ios-6/

    All the best!

    • adminDec 11, 2012 at 5:44 pmReplyAuthor

      I tried that but it still prompt user to login no link with the native facebook app..

  3. JonathanDec 11, 2012 at 6:23 pmReply

    Once you have installed the Facebook SDK, open the Samples folder in ~/Documents/FacebookSDK/Samples/HelloFacebookSample/

    This thing uses the native iOS Facebook Popup. (Maybe the Facebook SDK is not required for that!)

    Unless I’m a objective c noob, could you take a look at this? it’s just one method call that opens the facebook share dialog but I don’t know how to use it in my project / add it as a phonegap plugin


  4. adminDec 11, 2012 at 6:41 pmReplyAuthor

    Yes you are right just saw it is possible. I will check and update you. #thanks

  5. JonathanDec 11, 2012 at 7:04 pmReply

    Thank you so much for your great support!

    All the best,

  6. JonathanDec 13, 2012 at 5:50 pmReply

    Hey ,

    any news so far? ;)

    • adminDec 13, 2012 at 5:53 pmReplyAuthor

      I have done that and it is working properly. but it will crash with ios 5 and it will work perfectly with IOS 6 .

      After installing the facebook SDK to the project.

      Replace the current showFacebook function with the below code. I will upload the file soon.

      - (void) showFacebook:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options

      callbackId = [[arguments objectAtIndex:0] retain];

      NSString *fbText = [arguments objectAtIndex:1];
      NSString *webUrl = [arguments objectAtIndex:2];

      NSString * encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(
      kCFStringEncodingUTF8 );
      NSString *fbShareText = [NSString stringWithFormat:@"%@%@%@%@", @"fb://publish?text=",fbText,@"%20" ,encodedString ];

      NSString *webFbUrlStr = [NSString stringWithFormat:@"%@%@", @"http://www.facebook.com/sharer.php?u=", webUrl ];

      // if it is available to us, we will post using the native dialog
      BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:super.viewController
      url:[[NSURL alloc] initWithString:webUrl]
      if (!displayedNativeDialog)
      NSURL *webFbUrl = [NSURL URLWithString:webFbUrlStr ];
      NSURL *theURL = [NSURL URLWithString:fbShareText ];

      if ([[UIApplication sharedApplication] canOpenURL:theURL])
      [[UIApplication sharedApplication] openURL:theURL];
      [[UIApplication sharedApplication] openURL:webFbUrl];


      CDVPluginResult* pluginResult = nil;
      pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@""];

      NSString* javaScript = nil;
      javaScript = [pluginResult toSuccessCallbackString:callbackId];
      [self writeJavascript:javaScript];


  7. JonathanDec 14, 2012 at 4:52 pmReply

    OK sounds great.

    Please inform me as soon as you have uploaded the file.

  8. adminDec 14, 2012 at 5:58 pmReplyAuthor

    HI Jonathan,

    You can download it form the below link.


  9. DjimDec 19, 2012 at 2:24 pmReply

    Do you have Androïd classes for this plugin ?

  10. KinG-InFeTFeb 5, 2013 at 2:04 pmReply

    run on iOS 6.1 out error 2013-02-05 15:01:10.576 Linkpass[2462:c07] *** Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]‘
    *** First throw call stack:
    (0x43c012 0x29e6e7e 0x3de0b4 0x90bb5 0xff824 0xfeffc 0xfebad 0xfed45 0xfec63 0x29fa6b0 0x264f765 0x3bff3f 0x3bf96f 0x3e2734 0x3e1f44 0x3e1e1b 0x3de57e3 0x3de5668 0x898ffc 0x31ac 0×3105)
    libc++abi.dylib: terminate called throwing an exception

    method : showEmailComposer

  11. Senthil MuruganApr 1, 2014 at 10:42 amReply

    This is nice and useful.

    But i need the functionality in Cordova, that is take a screenshot of the current page and then share that taken screenshot image to facebook, twitter, pinterest and instagram.

    Please reply me, Any help will be appreciated

    • MateenJul 9, 2014 at 10:31 amReply

      Do you got any solution for the same.

  12. niranJun 3, 2014 at 6:58 amReply

    this is will work with iOS 7.0?

    • JonathanJun 19, 2014 at 12:57 pmReply

      It does.

Leave a reply

Your email address will not be published. Required fields are marked *


View Sarath D R's profile on LinkedIn

I am a technology consultant and an entrepreneur focused on the following technologies Java,Spring, Android, Angular, Asterisk, Symfony, Cake , Code-Igniter, Jquery , XAMPP, XHTML, AJAX, MySql, Seo, Web Design, Wordpress, iPhone development.

Today’s Tips
  • Generate Codova.jar file from Phonegap project using ant
  • Google map javascript client  to find the geographic co-ordinates  from  Address or post code
  • Update Android main UI from Webview – Phonegap Plugin
  • Jplayer is not working  with HTC One Android 4.3 version browser
  • Regular expression to validate mobile phone numbers starting with + ( plus ) – php
  • Simple pagination script for PHP
  • Useful adb ( Android Debug Bridge ) commands
  • Change the javascript files url to absolute url – Symfony 1.4
  • Set Http authentication header from Client – PHP / CURL

This site uses cookies from Google to deliver its services, to personalise ads and to analyse traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.This site also uses cookies from Google to deliver its services, to personalise ads and to analyse traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies.