Share plain text (not a link) to Facebook Messenger in Swift - ios

I have found ways to share links using FBSDKShareKit. But I want to share plain text only and not a link. contentDescription and contentTitle have been deprecated. Only text can be shared through UIActivityController but it is not what I want.
It can be done in Whatsapp using whatsapp://send?text=message, is there something along the similar lines for Facebook Messenger?

Related

Instagram - share image, text and url via iOS app : swift

I am trying to share image with some text and a url from my app to Instagram which would later redirect to iOS app installed on the phone from Instagram app. I am able to share image on instagram but not with text and url. Any help related to the same would be great!
A Bit Late To Answer (Aug, 2022)
I have successfully cracked the plain text sharing on Instagram by myself, after doing a lot of research on google on this topic. You can use the mentioned deep link to open Instagram Direct with some text to share from your application,
instagram://sharesheet?text={AnyTextOrLinkToShare}
Moreover, the below code should work on iOS to launch Instagram Direct (Messenger) from your app with some content
if let url = URL(string: "instagram://sharesheet?text=https://google.com/") {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
Not sure, why did they hide this information from their official documentation but now who cares, I have achieved it with the continuous efforts of 16-18 hrs! :)
Instagram had removed pushing custom captions to their app while sharing photos at one point, check this post.
I also understand, according to the Instagram iPhone Hooks page, that you can pass a photo only to the "Select A Filter" Instagram screen, which is before you set a caption. I'm sorry, but I don't think Instagram supports custom captions.
Looks like there is not official way to share image/sticker together with a text/link to Instagram - because "com.instagram.sharedSticker.contentURL" parameter bacame unavailable or private.
But there is one workaround how to proceed working with image/sticker & text/url consequentially described here: https://stackoverflow.com/a/74241318/20343737

iOS 8 Facebook share link, image and text

I want to share a content with an image, an url of my app on store and a caption of image.
I tried to using SLComposeViewController, but it not working on iOS 8.
I tried to using FaceBook share link, but it need an image url.
How can I share image + url + text without any server to store image?
Thanks all!
Due to FB policy is not possible to autofill the text of a share sheet using SLComposeViewController or UIActivityViewController. It seems to be still possible to share a link.
The behavior seems to be different if you have the official FB app installed:
If it is installed you can't add text
If not you can
The only solution seems to implement the official library, is really a pity!!

Share text AND media with WhatApp Share Extension

I'm using a UIActivityViewController to enable the user to share photos and videos created with my app. I attached two UIActivityItemProviders to it: one for the media and one for a default text to use ("Created with...").
This works well for all share extensions I tested—except for WhatsApp. WhatsApp only shows the text in the message dialog—no photo or video. When I leave the text blank, however, it will show the media file.
Is there any way I can share a photo or video with a default text/caption via WhatsApp?
I'm facing the same challenge. I implemented my own extension using https://github.com/sascha/SSCWhatsAppActivity. The downside is that you'll get two WhatsApp entries when sharing. WhatsApp's own one, and the custom one. I tried excluding WhatsApp's own extension using UIActivityViewController.excludedActivityTypes with the activityType net.whatsapp.WhatsApp.ShareExtension but since iOS 8.1 this is not possible anymore (on purpose or a bug). More on that here: http://johnszumski.com/blog/excluding-third-party-apps-from-ios-8-share-sheet
My conclusion, there is no way to provide both text + media to WhatApp own sharing extension. I decided to keep my custom WhatsApp sharing extension and name it "WhatsApp (+Image)" so the user can distinguish the two.

Post link to Facebook including app URL scheme - iOS 6

I'm using the UIActivityViewController to share an image and url from within my app.
I'm having trouble formatting the facebook post. I attach an image using a subclassed UIActivityItemProvider and provide the text for the post in the same way.
I want to add a url, but it needs my apps custom url scheme in front of it like this
myurl://image?url=http://imageurl.com
The problem is, when this is posted, only the last half of the url is clickable (from http:// onwards). Which means it doesn't open my app with the url.
Is there another way to do this?
I know I can create an app on Facebook, but how can I tie the two together using the UIActivityViewController?
Thanks
You have 2 options :
Create a simple server-side web service that will redirect from http://yourserver.com/linkToApp/image to myurl://image .
It could even show a different page/preview if the app is not installed/if you're not on an ios device.
Create a facebook app and use "Deep linking" (it will basically do the same for you..)

sharekit doesn't let me set custom facebook messages when sharing

When I share an image via Facebook using the latest version of the sharekit library, it sets the pre-filled status default message as the message, but doesn't give the user the opportunity to change that message like you can when sharing using sharekit on Twitter. Is this possible with Facebook using ShareKit?
You won't get around getting the text from the user if that's what you want. Otherwise you could pre-define a set of standard text's youself.
Changing the default share text inside ShareKit is very simple:
NSString *someText = #"This is a blurb of text I highlighted from a document.";
SHKItem *item = [SHKItem text:someText];
The documentation shows some more ways on how to use ShareKit at its best.
Yes, it is possible to use ShareKit with facebook have a look at the SHKConfig.h file.

Resources