Alok
Alok

Reputation: 25968

Facebook URL sharing issue with Social framework - iOS

I am getting issue for Facebook sharing (with social framework) on when i am appending my URL.

Its giving error on Facebook page. Sharing issue on facebook page

Code which i am using for sharing content on facebook:

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook
     ])
{
    SLComposeViewController *fbSheetOBJ = [SLComposeViewController
                                              composeViewControllerForServiceType:SLServiceTypeFacebook
                                              ];
    [fbSheetOBJ setInitialText:@""];
    [fbSheetOBJ addURL:[NSURL URLWithString:[[dict_BusinessDetails valueForKey:@"shared_lnks"] valueForKey:@"facebook_link"]]];
    [fbSheetOBJ addURL:[NSURL 
    NSURL *imageURL = [NSURL URLWithString:[dict_BusinessDetails valueForKey:@"business_logo"]];
    NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
    [fbSheetOBJ addImage:[UIImage imageWithData:imageData]];
    [self presentViewController:fbSheetOBJ animated:YES completion:nil];
}

Issue with only iOS devices, Everything is working fine with simulator.

Upvotes: 0

Views: 269

Answers (1)

insted of

fbSheetOBJ.addImage(UIImage.imageWithData(imageData))

try using:

bSheetOBJ.addImage(UIImage.pin_decodedImageWithData(imageData))

Upvotes: 0

Related Questions