STActivities
STActivities consist of UIActivity subclasses for replacing the standard Twitter and Facebook UIActivities. In iOS 7 and prior embedded Facebook and Twitter UIActivities don't show up in a list of activities if user is not logged into these accounts in iOS Settings. By replacing the embedded activities with these these two, you can make the icons always show up in the list.
How to install
Either copy files from STActivity
directory to your project directly or include the following line into your Podfile file:
pod 'STActivity', :git => 'https://github.com/uson1x/STActivities.git'
How to use
- Include required headers
#import "STFacebookActivity.h"
#import "STTwitterActivity.h"
- Initialize
UIActivityViewController
using@[[STFacebookActivity new], [STTwitterActivity new]]
as applicationActivities array - Set
excludedActivityTypes
to@[UIActivityTypePostToFacebook, UIActivityTypePostToTwitter]
- Present created UIActivityViewController as usual
NSString * sharingText = @"Test text";
UIActivityViewController * activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[sharingText]
applicationActivities:@[[STFacebookActivity new],
[STTwitterActivity new]]];
activityVC.excludedActivityTypes = @[UIActivityTypePostToFacebook, UIActivityTypePostToTwitter];
[self presentViewController:activityVC animated:YES completion:nil];