How do I set recipients for UIActivityViewController in iOS 6?

For adding subject to the email using UIActivityViewController on iOS6, this is the best solution that anyone can use.. All you have to do is call the following while initializing UIActivityViewController. UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities]; [activityViewController setValue:@”My Subject Text” forKey:@”subject”]; And your UIActivityViewController is populated with a subject.

How to exclude Notes and Reminders apps from the UIActivityViewController?

If you don’t want to subclass UIActivityViewController you can include them in your .excludedActivityTypes when creating your UIActivityViewController. Objective C: UIActivityViewController *activityController = [[UIActivityViewController alloc]initWithActivityItems:sharingItems applicationActivities:nil]; activityController.excludedActivityTypes = @[ UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeAddToReadingList, UIActivityTypeSaveToCameraRoll, UIActivityTypeOpenInIBooks, @”com.apple.mobilenotes.SharingExtension”, @”com.apple.reminders.RemindersEditorExtension” ]; [self presentViewController:activityController animated:YES completion:nil]; Swift 4.2: let activityController = UIActivityViewController(activityItems: sharingItems, applicationActivities: nil) activityController.excludedActivityTypes = [ UIActivity.ActivityType.assignToContact, UIActivity.ActivityType.print, … Read more

Basic example for sharing text or image with UIActivityViewController in Swift

UIActivityViewController Example Project Set up your storyboard with two buttons and hook them up to your view controller (see code below). Add an image to your Assets.xcassets. I called mine “lion”. Code import UIKit class ViewController: UIViewController { // share text @IBAction func shareTextButton(_ sender: UIButton) { // text to share let text = “This … Read more

I have REAL misunderstanding with MFMailComposeViewController in Swift (iOS8) in Simulator

* * IMPORTANT – DO NOT USE THE SIMULATOR FOR THIS. * * Even in 2016, the simulators very simply do not support sending mail from apps. Indeed, the simulators simply do not have mail clients. But! Do see the message at the bottom! Henri has given the total answer. You MUST — allocate and … Read more

UIActivityViewController crashing on iOS 8 iPads

On iPad the activity view controller will be displayed as a popover using the new UIPopoverPresentationController, it requires that you specify an anchor point for the presentation of the popover using one of the three following properties: barButtonItem sourceView sourceRect In order to specify the anchor point you will need to obtain a reference to … Read more

How can I create a custom UIActivity in iOS?

First, create the files. I chose to name mine ActivityViewCustomActivity Make ActivityViewCustomActivity.h look like this: #import <UIKit/UIKit.h> @interface ActivityViewCustomActivity : UIActivity @end Make ActivityViewCustomActivity.m look like this: #import “ActivityViewCustomActivity.h” @implementation ActivityViewCustomActivity – (NSString *)activityType { return @”yourappname.Review.App”; } – (NSString *)activityTitle { return @”Review App”; } – (UIImage *)activityImage { // Note: These images need … Read more