Search code examples
iosfacebookemailtwittersharekit

iOS >> ShareKit >> Selecting the Required Sharing Services


I've implemented ShareKit in my app. I'm OK with the default way that it works, but I wish to control the services available to the user to select from; to be more specific, I don't want to deal with all the service embedded by default and just have Facebook, Twitter and Mail.

Where in the ShareKit files do I do these settings (removing all of these neglected services that I don't want to deal with their APIs and such)?


Solution

  • You would need to edit SHK.m in the ShareKit framework. Change the favoriteSharersForType: method to only:

    favoriteSharers = [NSArray arrayWithObjects:@"SHKFacebook", @"SHKTwitter", nil];
    return favoriteSharers;
    

    You can add/remove services from this array as you please.

    EDIT

    To remove the More... button, locate the actionSheetForType method in SHKActionSheet.m and remove:

    [as addButtonWithTitle:SHKLocalizedString(@"More...")];

    After completing this, you will need to fix the indices. Locate the dismissWithClickedButtonIndex: delegate method and delete the entire else if (buttonIndex == sharers.count) block.