Skip to content
Vilém Kurz edited this page Dec 28, 2015 · 40 revisions

Q: I have added ShareKit to my project as submodule. How can I update it?

A: It is done in terminal. Assuming you are in your project' root directory, go to ShareKit directory:

cd Submodules/ShareKit

and download newest version of ShareKit:

git checkout master
git pull

It can happen, that also ShareKit is using newer version of its submodules, or some new are added. Make sure you download them too(*):

git submodule init  
git submodule sync
git submodule update

Now you should tell your project, that ShareKit has been updated. Go to back your project root:

cd ../..

Your project git repo treats submodules as a reference to particular commit - now git updates the reference to actual ShareKit's commit:

git add Submodules/ShareKit
git commit -m 'ShareKit updated to the newest version'

(*) if you look at some of the submodules original repo on github (say facebook-ios-sdk), you may notice, that there is newer commit, than that you got with submodule update. This is because submodule update does checkout submodule to the commit specified in ShareKit, which may not be the latest in original submodule's repo.

Q: How can I support older iOS?

You can use 9bb1fcfad979eb7b0c73104aa1e505b3c16115f2 commit for 5.0-5.1.

Q: How can I remove unwanted sharers when using git submodule/subproject install?

Easiest is to supply your own sharers plist, for more info see DefaultSHKConfigurator.m,

- (NSString *)sharersPlistName

However, this way all sharers are compiled, though not included in your binary. If you wish not even compile them, there is a granular install

Q: How can I customize ShareKit's action sheet? I do not need "more..." button and just need to always show some specific services only. Say Twitter, Facebook and Mail.

It is super-easy now:

  1. copy SHKSharers.plist , give it different name and include only sharers you need. Add it to your project, and set it in your DefaultSHKConfigurator subclass in - (NSString*)sharersPlistName. This way you do not need to change original SHKSharers.plist and can upgrade (pull) easily.
  2. set desired sharers in configurator, in favorite sharers section. Otherwise you will see only those left from default setting.
  3. You can hide "more..." button in configurator. The setting is - (NSNumber*)showActionSheetMoreButton
  4. You can disable favourites reordering in configurator. Normally last used sharer is on the top in ShareKit's action sheet. The setting is - (NSNumber*)autoOrderFavoriteSharers

Q: Is it possible to make the shared item text or other properties different for each sharer service?

A: YES. Declare the class you call ShareKit from as <SHKShareItemDelegate> and implement delegate method like this:

-(BOOL) aboutToShareItem:(SHKItem*)item withSharer:(SHKSharer*)sharer {
    
    if ([sharer isKindOfClass:[SHKMail class]]) {
        item.text = @"This text will be shared if user chooses Email";
    }
    return YES;
}

Than set your class as a shareDelegate for SHKActionSheet:

SHKItem *item = [SHKItem text:@"Text to share"];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
actionSheet.shareDelegate = self;

Look at SHKShareItemDelegate.h for more info.

Q: How can I contribute to the project?

  • the biggest help is to test, or at least review pull requests. The more people test or judge pull requests, the greater is the speed of innovations. The better ShareKit becomes. How to test a pull request:
    1. Make and checkout a new test branch from master on your repo.
git checkout master
git branch test<Feature>
git checkout test<Feature>
2. Synchronize it with upstream master (ShareKit's master), so that it is up to date
git fetch upstream
git merge upstream/master
3. add remote pull requester's fork to your git repo as a remote
git remote add <requester> [email protected]:<requester>/ShareKit.git
4. find pull request's branch and pull this branch to your new test branch
git fetch <requester>
git merge <requester>/<pull request's branch>
5. test and give feedback
  • compare your language's localizable.strings file with english. If there are some strings missing, please add them and make a pull request. You do not have to got through the whole english file - the newly added strings should be at the end of the english file. If your language is missing, please consider making a translation.
  • read through the issues from time to time. Some of them are not issues, but new ideas. You can express an opinion - is it useful? Or harmful? Too specific or too complicating?? Why do you think so?
  • if you see some issues you can help to resolve, do so.
  • if you have any issue, crash etc please report it (if possible, include crash report too)
  • if you think of some enhancement, or missing feature, open an issue.
  • if you have any pull request on original ShareKit, or made an adjustment on your fork, and think that it would be benefit for the community, feel free to open a pull request

Q: I would like to add a new sharer. Where to start?

All the necessary information is here.

Q: I see ShareKit is translated to many languages. I have noticed, that in my app ShareKit speaks only languages my app speaks too.

You must set CFBundleAllowMixedLocalizations (or "Localized resources can be mixed” in XCode) to YES to allow frameworks to use extra languages.

Q: Is there any way to find username logged in each service?

Yes. You can call + (NSString *)username; method on any sharer class, e.g. [SHKFlickr username]. Keep in mind, that OAuth based sharers must fetch the info after successful login. They do it automatically after successful login. You might want to listen to SHKSendDidFinishNotification and then update your UI with username.

Q: How can I enable thorough debug console output for ShareKit?

Uncomment line 18 in Debug.h

Q: Can I enable auto–share for certain services?

Yes. Some sharers is auto-share disabled by default - you can not autoshare with them. For those you can, the easiest way to enable auto–share is to create a subclass for desired SHKSharer and override - (BOOL)shouldAutoShare method.

Q: Is there a flowchart of ShareKit's workflow?

Yes. You can find them in downloads section. They are of high level, some details are simplified in order to get an overall picture how SHK works. White objects are a functionality of base sharer classes (SHKSharer and SHKOAuthSharer. Blue objects are the responsibility of specific sharer subclasses. Yellow are settings from DefaultSHKConfigurator.

Q: How should ShareKit be credited?

ShareKit 2 is based on skelet put together by Nate Weiner. After few months it got abandoned - last commit was in 11.2010. This was a problem, as services frequently change API's and many bugs were showing up. The result was numerous forks, none of which was perfect. Few people decided to merge the best of them (08.2011) and this is a base for ShareKit 2.

Original ShareKit is MIT licenced, its licence is valid for ShareKit 2 too. If you want to write some credit, plase do not forget to add link to ShareKit 2.

Clone this wiki locally