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
iOS App Submission and Beta Review Process
Assertion Failure When Using Uisearchdisplaycontroller in Uitableviewcontroller
iOS Tesseract Ocr Image Preperation
How to Convert Text to Image on iOS
iOS Floating Video Window Like Youtube App
Detect Shake Gesture iOS Swift
Swift Read Userinfo of Remote Notification
Uitableview:Viewforheaderinsection: Not Called During Reloaddata:
How to Show Complete List When Keyboard Is Showing Up in Swiftui
Afnetworking: Handle Error Globally and Repeat Request
Watchkit Appicon - the App Icon Set Named "Appicon" Did Not Have Any Applicable Content
How to Add Headerview in Uicollectionview Like Uitableview's Tableheaderview
Obscure a Uitextfield Password
How to Custom Modal View Controller Presenting Animation
Using Global Variables in Objective-C
How to Link Googleanalytics 3.01 with Xcode 5 (Missing Required Architecture X86_64)