Uiactivityviewcontroller - Email and Twitter Sharing

UIActivityViewController and facebook/twitter

activityItems is a [AnyObject]. For example: let activityItems = [ UIImage(), "A string", NSURL() ].

There is a list here of which services support what type of objects.
http://nshipster.com/uiactivityviewcontroller/

Facebook, twitter and mail share without UIActivityViewController on iOS

yes there are different way to do it.there is build in framework for it...

SLComposeViewController /// for facebook and twitter

and

MFMailComposeViewController /// for Email

check this link here for facebook and twitter

and for sharing with Email check here

Share a video and text on Twitter, Instagram and other services using UIActivityViewController

I found the answer. The correct way to do this is to use the implementation of the UIActivityItemSource protocol. The reason for Instagram not showing up in the second solution where i am using the VideoActivityItemSource class is that i am returning an empty String in the activityViewControllerPlaceholderItem function.
Although Apple's documentation says that the type of the object returned in this function does not have to match the type that is used by the itemForActivityType function, it actually needs to be processable by the sharing service. In the case of Instagram it needs to be a video or an image, otherwise Instagram does not show up as a sharing option in the actionsheet.

So the solution is to return a UIImage in the activityViewControllerPlaceholderItem function instead of an empty String, then both Twitter and Instagram will show up as sharing options.

func activityViewControllerPlaceholderItem(activityViewController: UIActivityViewController) -> AnyObject {
// this needs to return some random image to make sure Twitter and Instagram show up in the sharing actionsheet
return UIImage(named: "someImage")!
}

UIActivityViewController won't post URL to Twitter and Facebook

NSURL *url = [NSURL URLWithString:@"www.google.com"];

Is not a valid URL. It does not have a scheme. Try:

NSURL *url = [NSURL URLWithString:@"http://www.google.com"];



Related Topics



Leave a reply



Submit