Facebook Submission Dialog in iOS App

I have an iOs application in which I invite the user to share the link with the friends he wants. I want to offer him the opportunity to open a new mailbox from the application and, if possible, with pre-filled content. But there is no pre-filled recipient. And I want it to be available to all users (not only those who have a facebook connection).

Basically, I want to replicate the following submit dialog for a web application in an application : https://developers.facebook.com/docs/reference/dialogs/send/

This means that it will open the facebook application, not the browser, to display the new Inbox dialog box.

From my research, I did not find a clear solution, and, as possible on the website, I would be surprised that I can not do the same with the application.

Thank you very much in advance Jules

+6
source share
1 answer

You can use the UIActivityViewController .
First you need to create a list of things you want to split: URL, string, etc., For example,

 NSArray *activityItems = @[[NSURL URLWithString:@"www.link-to-share.com], @"What you want written above"]; 

After that, you just need to create a UIActivityViewController with the things you want to share and present them modally:

 UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil]; [self presentViewController:activityController animated:YES completion:nil]; 

You can also add a completion block so that you are notified when the user has shared:

 [activityController setCompletionHandler:^(NSString *activityType, BOOL completed){ //do stuff }]; 
+1
source

Source: https://habr.com/ru/post/953089/


All Articles