2
votes

After the iOS 11 relase, the SLComposeViewController is depraceted/not allowed sharing. So iOS developers have to use native Facebook and Twitter SDK to share content. And my problems is raising from this point.

I have been developing a new app which is needed facebook sharing with link, photo and description. i have done separately sharing with photo or link with native FBSDK. But i want to ask you, anyone know how can i use photo and link and description in the same Facebook Dialog. Because in my scenario, i have to share discount detail with discounting shop web site(https://emregurses.com/....../shoes), and discount foto(shoes or bag) and the detail text(Hurry up, you can buy until the midnight)

You can see below codes which i use to share separately.

Photo Share

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
shareButton = [[FBSDKShareButton alloc] init];


if (shareImage) {
    FBSDKSharePhoto *sharePhoto = [[FBSDKSharePhoto alloc] init];
    sharePhoto.caption = facebookTitle;
    sharePhoto.image = shareImage;

    FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
    content.photos = @[sharePhoto];
}

shareButton.shareContent = content;
[shareButton sendActionsForControlEvents: UIControlEventTouchUpInside];

Link Share

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
    shareButton = [[FBSDKShareButton alloc] init];

    if (facebookUrl) {
        content.contentURL = [NSURL URLWithString:facebookUrl];
    }else{
        content.contentURL = [NSURL URLWithString:@"https://fastpay.com.tr/"];
    }

    shareButton.shareContent = content;
    [shareButton sendActionsForControlEvents: UIControlEventTouchUpInside];

But i want to share all of them in the same FBShare dialog as the before SLComposeViewController. Also imageURL property is deprecated the new SDK.

@property (nonatomic, readonly) NSURL *imageURL
  DEPRECATED_MSG_ATTRIBUTE("`imageURL` is deprecated from Graph API 2.9");
1

1 Answers

1
votes

You can not share predefined text via facebook share.this is the limitation by facebook you can read more here

Use of the iOS share sheet is subject to Facebook Platform Policy, including section 2.3 which states that apps may not pre-fill in the context of the share sheet. This means apps may not pre-fill the share sheet's initialText field with content that wasn't entered by the user of the app.