How to customise UIActivityViewController to my selected apps? - ios

I have customised UIActivityViewController as possible from my side. I have excluded all items from it as listed below:-
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:#[videoURL] applicationActivities:nil];
controller.excludedActivityTypes = #[UIActivityTypePostToWeibo,
UIActivityTypeMail,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo,
UIActivityTypeAirDrop,
UIActivityTypeOpenInIBooks,
#"com.apple.mobilenotes.SharingExtension",
#"com.apple.reminders.RemindersEditorExtension"];
[self presentViewController:controller animated:YES completion:nil];
Now I only want to show Message, Facebook, Instagram, and WhatsApp in the ActivityController.
1- How can I exclude all other installed app from list to show only above mentioned apps?
2- I also wants to exclude 'Add to iCloud Drive' from list.
Note: I have already tried customised action sheet and able to share image only with it. But I want to share video in above mentioned apps. And they are not providing any way to share video.
Please help, thanks in advance.
Attachments after my code execution.

Related

Change activity items base on which application is selected for sharing in iOS

I share an image with text to othe applications.
NSArray *activityItems = #[title, finalImage];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityVC.excludedActivityTypes = #[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo];
[self presentViewController:activityVC animated:TRUE completion:nil];
Problem with this code is that I share title and image for all destination apps. but for instance, WhatsApp has problem when I share image with title. When I delete title it will correctly share the image but when I add title to activityItems, it just sends title. I want to detect if whats app is selected and then just send the image

UIActivityViewController show in different language

i want to remove or translate 'more' from english to russian.
Controller initiated simply as follows:
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:#[fbAct, vk2Act, okAct, twAct, gpAct, mailAct]];
[self presentViewController:activityVC animated:YES completion:nil];
You can't hide or remove more button according to apple policy
It comes as the default language of iPhone
If u need to change that you can use custom library https://github.com/overshare/overshare-kit

UIActivityViewController called from UITableViewCell incorrectly displayed

I have a UITableView in a UIViewController that is embedded in a Navigation Controller. The UIViewController is arranged using Auto Layout. I am using SWTableViewCell to enable swipe left-to-right. This displays a 'share' button which displays a UIActivityViewController when tapped.
The problem is, the UIActivityViewController displays incorrectly when called, squished to the left side of the view and attached to the top left corner. See images below for example, the first is during display of the UIActivityViewController, and the second is once the UIActivityViewController is displayed.
I haven't been able to find any other posts about this type of issue. The code below is how I call the UIActivityViewController from the - (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index method of SWTableViewCell delegate.
WhatsAppMessage *whatsappMsg = [[WhatsAppMessage alloc] initWithMessage:shareItem forABID:nil];
NSArray *activityItems = #[shareItem, whatsappMsg];
NSArray *applicationActivities = #[[[JBWhatsAppActivity alloc] init],[[LINEActivity alloc] init], [[WeixinTimelineActivity alloc] init],[[WeixinSessionActivity alloc] init]];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
activityViewController.excludedActivityTypes = #[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, UIActivityTypeAddToReadingList, UIActivityTypePostToVimeo, UIActivityTypePostToFlickr, UIActivityTypeAirDrop];
[self.navigationController presentViewController:activityViewController animated:YES completion:^{}];
Any ideas?
I finally found the answer and I knew it had something to do with auto layout. Earlier in the project I had most of my auto layout constraints set in code and I had put the following line in my AppDelegate.m file:
self.window.translatesAutoresizingMaskIntoConstraints = NO;
After removing this line, the UIActivityViewController loads perfectly!
Hopefully this helps others who run into this issue.

ActivityItems in UIActivityViewController don't show up

I'm developing an app in iOS 7 and in it I need to show an activity controller. Below is my code,
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:#[UIActivityTypeSaveToCameraRoll, UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypeMail, UIActivityTypeMessage, UIActivityTypePrint] applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
But when its presented, this is how it looks.
None of the activity types I added in the array shows up. Why is this happening? Am I missing something? I'd like some help to get this working. I especially need the Facebook, twitter sharing and the saving to the local storage options here.
Thank you.
Edit: I checked on a real device and the Facebook and Twitter sharing options show up. However UIActivityTypeSaveToCameraRoll, UIActivityTypePrint still aren't showing up.
The Items will show up only if you have integrated them to your Device.
If you have integrated facebook and Logged into facebook in the settings then Facebook will appear along the Items. That means your device must be Synchronised with the native Facebook, Twitter, etc Apps for them to show up in the UIActivityViewController
Edit:
Try using like this
UIActivityViewController *ActivityView;
ActivityView =
[[UIActivityViewController alloc]
initWithActivityItems:Items applicationActivities:nil];
[self presentViewController:ActivityView animated:YES completion:nil];

UIActivityViewController: PostToTwitter: text can´t be changed in presented modal View

i have a problem with iOS 6´s UIActivityViewController. I want to share an image and a text.
When i share it via Facebook, the text is editable in the modal view. In Twitter, i can't change the text. is there a way to change it for Twitter, so that the text is editable ?
This is my code:
NSArray *activityItems = #[#"Test Text",resultImage];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityVC.excludedActivityTypes = #[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeCopyToPasteboard,UIActivityTypeMessage,UIActivityTypePostToWeibo];
[self presentViewController:activityVC animated:YES completion:nil];

Resources