'How to share an image from IOS app to Facebook?

I am trying to share an image from my app to a user's Facebook page. I believe I have all the Facebook set up done correctly and the dialog pops up with the image and lets me go through all the motions, but nothing shows up in Facebook.

Here is my relevant code:

func shareFaceBook(){
    if let token = AccessToken.current, !token.isExpired {
        DispatchQueue.main.async {
            guard let gameView: UIView = self.view.viewWithTag(11000) else {return}
            gameView.backgroundColor = UIColor(red: 2/255.0, green: 44.0/255.0, blue: 232.0/255.0, alpha: 1.0)
            let image = UIImage(data: gameView.asJpeg!)!
            let photo = SharePhoto(
                    image: image,
                    userGenerated: true
            )
            let content = SharePhotoContent()
            content.photos = [photo]
            ShareDialog(fromViewController: self, content: content, delegate: self).show()
        }
    }
    else {
        fbLogIn()
    }
}

func sharer(_ sharer: Sharing, didCompleteWithResults results: [String : Any]) {

    if sharer.shareContent.pageID != nil {
        print("Share: Success")
    }
    else {
        print("No Page ID")
    }
}

and here are the issues it is telling me about that I am not sure if they are the problem or just warnings. Either way, I don't know what to do about it.

2022-02-16 09:43:49.924212-0500 Word Cube[4272:588434] [Word Cube] findWriterForTypeAndAlternateType:119: unsupported file format 'public.heic'

2022-02-16 09:43:50.004307-0500 Word Cube[4272:588434] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement +_allowedItemPayloadClasses. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error. Extension: <EXConcreteExtension: 0x2817df300> {id = com.apple.share.Facebook.post} Items: ( "<NSExtensionItem: 0x2820dc100> - userInfo: {\n NSExtensionItemAttachmentsKey = (\n "<NSItemProvider: 0x2809df870> {types = (\n \"public.jpeg\"\n)}"\n );\n NSExtensionItemAttributedContentTextKey = {length = 367, bytes = 0x7b5c7274 66315c61 6e73695c 616e7369 ... 37393632 225c7d7d };\n}" )

No Page ID

2022-02-16 09:43:56.897157-0500 Word Cube[4272:588434] [core] SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source