Pregunta

I have an iphone app which used sharekit and i installed using submodules according to this documentation:

https://github.com/ShareKit/ShareKit/wiki/Installing-sharekit

Twitter and Facebook sharing worked fine using this method.

Now i want to move over to cocoapods, i added this to my Podfile:

pod 'ShareKit/Core'
pod 'ShareKit/Facebook', '~> 2.5.6'
pod 'ShareKit/Twitter', '~> 2.5.6'

did a pod update and everything installed and compiled ok.

But when i do a share within the app now, it doesnt show the facebook and twitter share options.

I have sub classed DefaultSHKConfigurator and i have implemented the methods:

- (NSString*)appName {
    return @"XYZ App";
}

- (NSString*)appURL {
    return @"someurl";
}


- (NSNumber*)showActionSheetMoreButton {
    return [NSNumber numberWithBool:false];
}

- (NSString*)twitterConsumerKey {
    return @"customerKey";
}

- (NSString*)twitterSecret {
    return @"secretKey";
}
// You need to set this if using OAuth, see note above (xAuth users can skip it)
- (NSString*)twitterCallbackUrl {
    return @"someurl/oauth";
}

- (NSString*)facebookAppId {
    return @"555555555";
}

- (NSString*)facebookLocalAppId {
    return @"lite";
}


- (NSArray*)facebookWritePermissions {
    return [NSArray arrayWithObjects:@"publish_actions", nil];
}
- (NSArray*)facebookReadPermissions {
    return nil; // this is the defaul value for the SDK and will afford basic read permissions
}

- (NSArray*)defaultFavoriteURLSharers {
    return [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook", @"SHKTextMessage", nil];
}


- (NSArray*)defaultFavoriteImageSharers {
    return [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook", @"SHKTextMessage", nil];
}
- (NSArray*)defaultFavoriteTextSharers {
    return [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook", @"SHKTextMessage", nil];
}

- (NSNumber*)autoOrderFavoriteSharers {
    return [NSNumber numberWithBool:false];
}

- (Class)SHKActionSheetSubclass {
    return NSClassFromString(@"CustomSHKActionSheet");
}

- (NSNumber*)maxFavCount {
    return [NSNumber numberWithInt:4];
}

Also in my app delegate im definately calling the custom Configurator.

  DefaultSHKConfigurator *configurator = [[[SHKConfigurator alloc] init] autorelease];
    [SHKConfiguration sharedInstanceWithConfigurator:configurator];

What i have noticed from debugging is that only method: showActionSheetMoreButton is called and not any of the others.

I have also noticed that the "canShare" methods in SHKTwitter.m and SHKFacebook.m both return false. And the "canShare" methods in SHKiOSTwitter.m and SHKiOSFacebook.m are never called (these are the native versions so i guess these should be called)

Any idea why these sharers are not displaying?

¿Fue útil?

Solución

Instead of using SHKFacebook and SHKTwitter use SHKiOSFacebook and SHKiOSTwitter accordingly:

- (NSArray*)defaultFavoriteURLSharers 
{
    return [NSArray arrayWithObjects:@"SHKiOSTwitter",@"SHKiOSFacebook", @"SHKReadItLater", nil];
}

Note:

If you already have used Sharekit in your app, then the defaultFavoriteURLSharers will not be called, since Sharekit will get them from the device preferences. In order to deal with it you have to clean your preferences (by reinstalling your app) or even you can change the key that the prefs are stored in ShareKit/Core/SHK.m:favoritesKeyForItem (not recommended).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top