uson1x / STActivities

STActivities consist of UIActivity subclasses for Twitter and Facebook sharing, which send users to Setting if they are not logged into their accounts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Include required headers
#import "STFacebookActivity.h"
#import "STTwitterActivity.h"
  1. Initialize UIActivityViewController using @[[STFacebookActivity new], [STTwitterActivity new]] as applicationActivities array
  2. Set excludedActivityTypes to @[UIActivityTypePostToFacebook, UIActivityTypePostToTwitter]
  3. 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];

About

STActivities consist of UIActivity subclasses for Twitter and Facebook sharing, which send users to Setting if they are not logged into their accounts.

License:MIT License


Languages

Language:Objective-C 89.9%Language:Ruby 10.1%