-
Notifications
You must be signed in to change notification settings - Fork 0
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 development
git pull
It can happen, that also ShareKit is using newer version of its submodules, or some new are added. Make sure you update them(*):
git submodule init
git submodule update
Now you should tell your project, that ShareKit has been updated. Go to back your project root:
cd ..
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 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: Is it possible to make the shared item text or title slightly different for each sharer service?
A: YES. You can use SHKCustomActionSheet, and override
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
{
[[VariableWarehouse sharedInstance] playSound:@"touch"];
[self changeItemForService:buttonIndex];
[super dismissWithClickedButtonIndex:buttonIndex animated:animated];
}
- (void)changeItemForService:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
self.item.text = [self.item.text stringByAppendingString:@"suffix for service 1"];
}
}
if you do this, it is recommended that you first copy SHKCustomActionSheet.m file outside of ShareKit submodule folder, and replace the file in the project instead of original ShareKit version. Then edit the "outside" file. This way it will not interfere with ShareKit submodule updates.
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. There are two ways services interact with ShareKit - some store credentials in user's keychain, some do not. If they do not, ShareKit has to fetch and store available user info (e.g. username) after successful login in NSUserDefaults.
Facebook:
NSDictionary *facebookUserInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"];
NSString *fbUserName = [facebookUserInfo objectForKey:@"name"];
Twitter (pre iOS 5. In iOS 5 you have to ask account framework for available twitter users):
NSDictionary *twitterUserInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKTwitterUserInfo"];
NSString *twUserName = [twitterUserInfo objectForKey:@"screen_name"];
other sharers (sharer ID is a name of the sharer's class, e.g. SHKTumblr):
[SHK getAuthValueForKey:@"username" forSharer:sharerId];
or some sharers (Tumblr, Google reader) use email as username:
[SHK getAuthValueForKey:@"email" forSharer:sharerId];
Q: How can I enable thorough debug console output for ShareKit?
Uncomment line 33 in DefaultSHKConfigurator.h