Missing Image when using SLComposeViewController with Twitter on real device

671 views Asked by At

My code implementation is really straightforward:

if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeTwitter) {

    guard let composeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter) else {

        return
    }

    composeViewController.add(image)
    composeViewController.setInitialText("some text")

    present(composeViewController, animated: true, completion: nil)
}

However, when the Twitter screen opens over the app, with the dialog, it is not showing the image on it.

If I run the same code in the Simulator it works without problem.

When I try to post in real device, even without the image, the post never gets to Twitter.

Commenting out the add(image code) like:

    //composeViewController.add(image)

With this line commented out the post works without problem and it is posted to Twitter.

When running the app in real device this is the console text:

[core] SLComposeViewController isAvailableForServiceType com.apple.social.twitter
[core] SLComposeViewController isAvailableForServiceType got serviceType com.apple.social.twitter isAvailable 1
[core] SLComposeViewController isAvailableForServiceType com.apple.social.twitter returning 1
[core] SLComposeViewController initWithServiceType: com.apple.social.twitter
[core] SLComposeViewController initWithServiceType got extension <NSExtension: 0x174170200> {id = com.apple.share.Twitter.post} for identifier com.apple.share.Twitter.post
[core] SLComposeViewController initWithExtension: <NSExtension: 0x174170200> {id = com.apple.share.Twitter.post} requestedServiceType: com.apple.social.twitter
[core] SLComposeViewController initWithExtension got override extension <NSExtension: 0x174170200> {id = com.apple.share.Twitter.post}
[core] addImage start
[core] viewWillAppear
[core] SLComposeViewController building implicit NSExtensionItem from array of 1 _itemProviders
[core] SLComposeViewController setting first extensionItem.attributedContentText to 'some text'
[core] SLComposeViewController about to instantiate remote view controller with array of 1 NSExtensionItems
[core] viewDidAppear
[core] SLComposeViewController finished instantiate remote view controller <SLRemoteComposeViewController: 0x12610d200> error (null) extension request identifier 1E964C0A-778C-498C-A092-C1D9C3F8C542
[core] SLComposeViewController received remoteViewController of class SLRemoteComposeViewController, and setting its delegate to self
[core] HOST: Successfully loaded remote SLComposeVC
[core] [remoteViewController setupRemoteViewController]
[core] Finished setting up remote view controller

Nothing special

0

There are 0 answers