using FBSDKShareLinkContent not able to share text in iOS 9

2.3k views Asked by At

I am try to share text in Facebook using app. i am able to do login but when i tried to share text getting this enter image description here

Once i clicked ok every thing is gone and i am logged in Facebook app in device still asking to log in

#import <FBSDKShareKit/FBSDKShareKit.h>

  FBSDKShareLinkContent *content1 = [[FBSDKShareLinkContent alloc] init];
    content1.contentURL = [NSURL URLWithString:@"http://en.wikipedia.org/wiki/Facebook"];

    content1.contentDescription=content;
    content1.contentTitle=@"Hello";
   // content1.imageURL=imageURL;
    [FBSDKShareDialog showFromViewController:self withContent:content1 delegate:nil];

getting this in log

plugin com.apple.share.Facebook.post invalidated
2

There are 2 answers

1
Ahmed Abdallah On
- (IBAction)shareActionButton:(id)sender {



     NSString *textToShare = @"Your Text to share";
        NSURL *myWebsite =[NSURL URLWithString:@"Your URL"];
        NSArray *objectsToShare = @[textToShare, myWebsite];
        UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
        [self presentViewController:activityVC animated:YES completion:nil];

}  
4
Uma Madhavi On

This is working fine.

-(IBAction)shareAction:(id)sender

{

    FBSDKShareLinkContent *content1 = [[FBSDKShareLinkContent alloc] init];
    content1.contentURL = [NSURL URLWithString:@"http://en.wikipedia.org/wiki/Facebook"];
    content1.contentTitle=@"Share";
    [FBSDKShareDialog showFromViewController:self withContent:content1 delegate:nil];
}