使用FBSDKShareLinkContent无法在iOS 9中共享文本

时间:2016-01-21 10:35:25

标签: ios objective-c iphone facebook fbsdksharekit

我尝试使用app在Facebook上分享文字。我能够登录,但当我试图分享文本得到这个 enter image description here

一旦我点击确定,所有事情都消失了,我登录的Facebook应用仍然要求登录设备

#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];

将其记录在日志中

plugin com.apple.share.Facebook.post invalidated

2 个答案:

答案 0 :(得分:2)

这很好。

-(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];
}

答案 1 :(得分:0)

- (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];

}