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

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.

Related

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

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?

How do you get the Twitter and Facebook icons in your apps

I created a Twitter and Facebook SHARE buttons. However, I don't know if i'm allowed to use the official Twitter bird logo and the official Facebook F logo as a custom image button on my app. Are developers allowed to do that or are we supposed to get permission from Facebook and Twitter? Or should I just create a custom button that says Facebook, Twitter on it? I've seen only official facebook and twitter logos on game apps and other apps. How is it done?
Both Facebook and Twitter have strict guidelines for that, which you can find on their corresponding developer sites. You will also find the necessary resources (i.e. images) on these sites. It is typically not ok to use custom images.
That said, the official guides are not always followed and personally I have never heard of anyone being held responsible for doing it wrong. But I would strongly encourage you to follow them in any case.
At least for Facebook, I would always advise to use the official SDK and the Share Button it provided. You can read more here: https://developers.facebook.com/docs/sharing/ios#triggering
FBSDKShareButton *button = [[FBSDKShareButton alloc] init];
button.shareContent = content;
[self.view addSubview:button];

SLComposeViewController won't set initialText for SLServiceTypeFacebook

It seems as a bug in Social framework, it won't set the initial text for Facebook service type. This is my implementation using Swift:
let view = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
if view.setInitialText("Some text") {
NSLog("Success")
} else {
NSLog("Failure")
}
view.addURL(NSURL(string: "https://google.ro"))
self.presentViewController(view, animated: true, completion: nil)
What it works:
The URL shows up for both, Facebook, and Twitter
The initialText works correctly just for Twitter
What is doesn't work:
The initialText won't show up for Facebook, even though the code above outputs "Success"
Update 2
It seems like Facebook really doesn't want developers to set the initial text of a message when Sharing as that it's impossible even with their SDK. In the app I was implementing I've chosen screenshots from the app (uploaded as images) for letting the user share their progress on Facebook.
Update
The solution is to use the Facebook SDK for iOS, that feature of Social framework is not supported by Facebook anymore.
Not a bug, Facebook doesn't allow it anymore.
Use of the iOS share sheet is subject to Facebook Platform Policy, including section 2.3 which states that apps may not pre-fill. In the context of the share sheet, this means apps may not pre-fill the share sheet's initialText field with content that wasn't entered by people earlier in their use of the app.
Facebook dose't allow to pre fill message anymore.
For more info here
Saying that, if you use native Facebook sdk it won't solve your problem, because Facebook will not publish your app.
So as written on Facebook guidelines, the only solutions that you have are:
Populate the user message parameter with content that the user manually entered earlier in your app's flow.
Your app’s composer can include a call-to-action that disappears when people start to write a post. For example, Facebook's composer uses grey scale text to ask “What's on your mind?” that disappears when people start to write.
I think it is an iOs 8.3 bug.
Before I updated to that version it was working correctly. :-(

ios plugin com.apple.share.Facebook.post do not show provided text

In my app I'm using the following code that allows to share an image with a text:
- (IBAction)sharePressed:(id)sender {
UIImage *postingImage = [UIImage imageWithContentsOfFile:self.filepath];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:#[#"Lorem ipsum", postingImage] applicationActivities:nil;
[self presentViewController:activityViewController animated:YES completion:nil];
}
And when posting I can see image, but can't see text. Also text doesn't appear in FB.
I'm afraid to tell you, you cannot post text to Facebook programatically. It's a new Facebook prohibition that forbids "pre-filled" Facebook sharing. That is why newer versions of iOS do not show your text, even tough it's correctly provided (and works on Twitter and in other sharing options).
For more info please refer to https://developers.facebook.com/docs/apps/review/prefill)
I first saw this when Facebook updated their app on April 24th. Plain text sharing to Facebook isn't working as long as the Facebook app is installed. After you delete it, it's available again.
If you try to share a URL or an image together with the plain text, you will see Facebook as an option but the text field will be blank. The image or URL will attach without a problem.
I posted a sample project that reproduces this problem on github:
https://github.com/djr/UIActivityViewController-Facebook
This is not an answer, but it's pretty clear that the problem is caused by the Facebook app.

Instagram update to 5.0. How can I set "InstagramCaption" programmatically with iPhone hooks

As Instagram official document says
To include a pre-filled caption with your photo, you can set the annotation property on the document interaction request to an NSDictionary containing an NSString under the key "InstagramCaption". Note: this feature will be available on Instagram 2.1 and later.
For Instagram 4.x or lower, it works well. But for Instagram 5.0, Instagram team added a new feature called "Direct". When users upload a photo, they have two options "Followers" or "DIRECT". I think this is the reason why "InstagramCaption" doesn't work. Is there a new way to add caption programmatically?
Thank you so much!
self.dic.annotation = #{#"InstagramCaption" : captionString};
self.dic.delegate = self;
[self.dic presentOpenInMenuFromRect:shareButton.frame inView:self.view animated:YES];
It doesn't work now.
Best response I've gotten so far:
Thanks for your report and interest in the Instagram platform. We are aware of this issue and it will be fixed in the next update of the iOS app.
I followed up asking for a timeframe or anymore info on a workaround but have not heard anything.
This is fixed in Instagram Version 5.0.1.
It appears that they have removed the caption url parameter from their URL scheme though. So UIDocumentInteractionController can still pass a caption through the annotation property but trying to add one through the URL scheme is no longer supported.

Resources