Black Screen after Sharing on Facebook using UIActivityViewController.

Hi I am using UIActivityViewController to share content on social networks but facing one issue. The issue is when i select the share button the UIActivityViewController gets appear and I select the Facebook option.

I select the Facebook option in the sharing sheet -> Facebook sharing view appears with two options (Cancel and Next). When I select the Cancel button giving me another action sheet to discard or keep the post. When i select to discard the Action Sheet get disappear but the Facebook sharing view still keep showing and there is no way to go back.

Second when I press the next button in the Facebook sharing view -> another Facebook view gets appear with two buttons (Cancel and Share).... When I click the share button content get share on Facebook and black screen appears with a check in circle and text "Shared to Facebook!" .. And the application get stuck on this Screen.

Below is my code, Any help would be appreciated, I am also using the activityViewController!.completionWithItemsHandler but this closure not getting called in case of Facebook.

  let url = "\(UserDefaults.baseURL)/pl/\(resource)/\(sharingId)"
// set up activity view controller
let imageToShare = [ url ]
activityViewController = UIActivityViewController(activityItems: imageToShare, applicationActivities: nil)


activityViewController!.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
// exclude some activity types from the list (optional)
activityViewController!.excludedActivityTypes = [UIActivity.ActivityType.airDrop]

activityViewController!.completionWithItemsHandler = { (activityType: UIActivity.ActivityType?, completed:
Bool, arrayReturnedItems: [Any]?, error: Error?) in
    
    
    if completed {
        print("share completed")
        self.dismiss(animated: true)
        return
    } else {
        print("cancel")
        self.dismiss(animated: true)
    }
    if let shareError = error {
        print("error while sharing: \(shareError.localizedDescription)")
    }
}

// present the view controller
self.present(activityViewController!, animated: true, completion: nil)

We too noticed the issue. If we select to share, it stucks at "Shared to Facebook" with a black background. Only option is to QUIT the app.

Also the same behaviour is actually observed with Facebook app too when we try to share content from facebook to facebook.

Whenever I share anything to Facebook from my phone, be it a WORDLE results from my NYTimes app, or a webpage on Chrome, whenever I hit the share button, and I get the Black Screen, it gets stuck and I cannot do anything except reboot my iphone. Please someone, help!

I just figured out what to do! My Facebook app (and more) was not updated. Once I updated my app, the problem went away and shared to Facebook began to work properly. Open the App Store. Tap your profile icon at the top of the screen. Scroll to see pending updates and release notes. Tap Update next to an app to update only that app, or tap Update All.

Black Screen after Sharing on Facebook using UIActivityViewController.
 
 
Q