SLComposeViewController with screenshot but not image attachment - ios

I notice that Mobile Safari's Twitter and Facebook share adds a screenshot of the current page without actually sharing it, eg:
Im trying to duplicate this via SLComposeViewController, however calling the addImage: actually adds the UIImage to the tweet/facebook album (as expected).
Is there a way to just display the screenshot of the page without adding the image ?
Edit:
Looks like SLComposeViewController conforms to UIAppearanceContainer however the UI_APPEARANCE_SELECTOR is not documented.

Safari is previewing the screenshot to the website because it has it loaded and ready in on the screen, when you addURL: on the SLComposeViewController it doesn't resolve that URL and grab a preview.
Also when you addImage: that's exactly what it's doing, it's adding an image to your post, this isn't what you want, you just want to have a visual and not a safari logo/icon in place of the attachment indicating a link.
I can only say there is a private method on the SLComposeViewController class which is how Safari is adding a preview image for URLs added...
You should always get this in your app when sharing a URL:
That sucks, you should add a feature request (http://bugreport.apple.com) so that you can add your own preview here, maybe Apple will make that public in future iOS releases.

Related

Accessing preview image of SLComposeServiceViewController

Has anyone had any luck capturing the image preview, a screenshot of the website, that apple presents in the its share extension for safari webpages, without having to simply replicate the functionality?

Sharing a photo from an ios app

Given that I have a UIImage instance in my app how could I get
ios to show the image sharing dialog (Mail, add to notes, twitter, fb,
save image, etc)
Upon a cursory look to PHAsset I haven't found anything prominent :-(
You can search for UIActivityViewController. This class will display a dialog, having all sharing apps listed within dialog.

Replace UIActivityViewController twitter post action with a SLRequest

I am trying to share an animated GIF but default UIActivityViewController Twitter share doesn't support it yet which it will "scale down" it as a still JPG, I have to use SLRequest for it as taught in this article. The downside of that is no preview share sheet and users cannot type their own message anymore.
However, I saw SteppyPants that it seems using a custom action after users click "share" in Twitter share sheet, how can they do it?
In other word, how to replace the UIActivityViewController twitter share action to a custom action which includes SLRequest.
Things I tried:
UIActivityItemProvider and check UIActivityTypePostToTwitter, but
that's run after user click twitter and before editing the text
In UIActivityViewController completionWithItemsHandler delete the just twitted post (with still gif) and post again with SLRequest, but not too sure if I can delete the old post and it's consuming network bandwidth for users anyway
SLComposeViewController, does not support animated GIF upload and not custom share action at all
P.S. I am iOS newb
UIActivityItemProvider and check UIActivityTypePostToTwitter, but that's run after user click twitter and before editing the text
That's pretty close!
I believe Steppy Pants is doing what you said; providing a UIActivityItemProvider to the UIActivityViewController, but with a twist.
When the UIActivityItemProvider's item method is called, it checks if the UIActivityType is UIActivityTypePostToTwitter and if so, the UIActivityViewController is dismissed and a custom SLComposeServiceViewController is presented.
If you look closely you can see: The presented view controller doesn't have a title and the remaining character count doesn't respond correctly to URLs. The SLComposeServiceViewController object then implements didSelectPost to present a spinner UI while it initiates an SLRequest.

How can i create a facebook post in my app that looks alike a YouTube post

You know when you share a video from youtube to facebook, on facebook the post appears like this:
How can I achieve the same result when I share a video link from my app?
I was able to share a post with text and image as a link (the text on top of the image) using the SLComposeViewController class. I called the setInitialText, addImage, and addURL methods to set the text, image, and url respectively.
But I was not able to figure out how to make the thumbnail image on the left and the description of the video on the right. Please point me to the right direction. --> :)
Thanks

Show attached image on top of SLComposeViewController

When adding an image to SLComposeViewController, the image is shown to the right in the SLComposeViewController view. However it's shown below (as in layer below) another default image looking like a compass. On top of that is a clip. What is this compass image? I'd like to show the attached image on top. Would be nice instead of that grey thing.
The attached image is the white image below the compass.
I think I got it.
The compass means you also attached a URL to the social posting.
The order of the image and the compass is determined by the way you add that stuff to the SLComposeViewController itself. I was adding the URL first, then the image. Just change the order, and the things clipped to the posting will also change order. The first added item will show on top as it seems.
This is also true for TWTweetComposeViewController in iOS 5.
It seems the above works for Twitter. Facebook never shows any attached image...?
Edit: As for Facebook - As the Safari icon means "URL", I was able to show a thumbnail of the attached image by removing addURL: alltogether. It's weird. If you don't add a URL, you have the thumbnail of the image. You can even change the album # Facebook in which the image will be posted. If you add a URL, you ONLY get that Safari icon. Weird.

Resources