Learn Courses My Dashboard

Share to Facebook using UIActivity View Controller Times Out

When trying to share to Facebook via the native iOS sharesheet, the Facebook create dialog will open but when I go to post it, the Facebook progress screen shows for a second and then times out. I used to get a “Shared to Facebook!” success screen.

In the Xcode console when trying to share I am receiving the following errors:

SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceErrorDomain Code=1 “(null)” UserInfo={Terminated=disconnect method}

[ShareSheet] connection invalidated

I haven’t made any changes to the code; it just stopped working. Sharing to all the other platforms, iMessage, email, Twitter, Messenger all work fine. Just not to Facebook.

static func showShareSheet<Entity: Entry>(entry: Entity, VC: UIViewController) {
    var image = UIImage()
    var message = entry.message
    
    if entry.image != nil { image = UIImage(data: entry.image!)! }
    
    let shareSheetVC = UIActivityViewController(
        activityItems: [
            image,
            message],
        applicationActivities: nil)
    
    shareSheetVC.excludedActivityTypes = [.addToReadingList, .airDrop, .assignToContact, .markupAsPDF, .openInIBooks,
        .postToVimeo, .print]
    
    VC.present(shareSheetVC, animated: true) }

And the function is called as such:

SharingManager.showShareSheet(entry: self.entry!, VC: self)

Thank you for any help! I have spent hours researching to no avail!

If you are using the App on a real device then the chances are that the issue is with FaceBook given that as you say, all other share destinations work.