-
Notifications
You must be signed in to change notification settings - Fork 0
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