Facebook send dialog in iOS app
Asked Answered
D

1

6

I have an iOs app in which I tell the user to share a link with the friends he wants. I want to offer him the possibility to open a new inbox from within the app and if possible with pre-filled content. But no pre-filled recipient. And I want it to be available to all users (not only those with facebook connect).

Basically I want to replicate the following send dialog for web in the app: https://developers.facebook.com/docs/reference/dialogs/send/

Which means it will open the facebook app and not the browser to show the new inbox dialog.

From my research I found no clear solution and as it is possible from a website I would be surprised I cannot do the same with the app.

Thank you very much in advance, Jules

Denbrook answered 3/9, 2013 at 21:2 Comment(1)
#14712690Negative
D
1

You can use UIActivityViewController.
You first have to create a list of the things you want to share: an URL, a string, etc like this

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

Afterwards, you just have to create the UIActivityViewController with the things you want to share and present it 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 is done with the sharing:

[activityController setCompletionHandler:^(NSString *activityType, BOOL completed){
    //do stuff
}];
Disapprove answered 19/3, 2014 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.