ShareKit skip share sheet iOS 8 for Instagram

723 Views Asked by At

I am sharing an image from my app to instagram using ShareKit by doing this

UIImage *image = viewTheme.image;
SHKItem *item = [SHKItem image:image title:@"Check this out! "];
[SHK setRootViewController:self];
[SHKInstagram shareItem:item];

And it brings up a share sheet with a Facebook Button and a Open in Instagram button. So I was wondering if there was a way to call directly the open in instagram action or, if that's not possible, to remove that Facebook button ( and the More button too if it's possible).

enter image description here UPDATE

I have this in the app delegate

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

And my configurator subclass is this one

- (NSString*)appName {
    return [[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"];

}

- (NSString*)appURL {
    return @"https://github.com/ShareKit/ShareKit/";
}

# pragma mark - API Keys



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

- (NSString*)facebookLocalAppId {
    return @""; //Si no se usa se deja vacion
}

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


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

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

- (NSString*)twitterSecret {
    return @"naFO0wcOvGtoGJS6jPNFRREKYhfLTiXa9UtD1mRezzFP0q3Xcv";
}

- (NSString*)twitterCallbackUrl {
    return @"http://www.twitter.com";
}

- (NSNumber*)twitterUseXAuth {
    return [NSNumber numberWithInt:0];
}

- (NSString*)twitterUsername {
    return @"";
}


// Instagram crops images by default
- (NSNumber*)instagramLetterBoxImages {
    return [NSNumber numberWithBool:YES];
}

- (UIColor *)instagramLetterBoxColor
{
    return [UIColor whiteColor];
}

- (NSNumber *)instagramOnly {
    return [NSNumber YES];
}

#pragma mark - UI Configuration : Basic

- (NSNumber *)useAppleShareUI {
    return @YES;
}

- (UIColor*)barTintForView:(UIViewController*)vc {

    if ([NSStringFromClass([vc class]) isEqualToString:@"SHKTwitter"])
        return [UIColor colorWithRed:0 green:151.0f/255 blue:222.0f/255 alpha:1];

    if ([NSStringFromClass([vc class]) isEqualToString:@"SHKFacebook"])
        return [UIColor colorWithRed:59.0f/255 green:89.0f/255 blue:152.0f/255 alpha:1];

    return nil;
}

- (NSNumber*)showActionSheetMoreButton {
    return [NSNumber numberWithBool:false];// Setting this to true will show More... button in SHKActionSheet, setting to false will leave the button out.
}

I created also a quick example of what I'm trying to do, you can download it here: https://www.dropbox.com/s/n09gnq4ul3lcdtk/sharePodTest.zip?dl=0

1

There are 1 best solutions below

4
Vilém Kurz On

implement this method in your configurator subclass

///only show instagram in the application list (instead of Instagram plus any other public/jpeg-conforming apps) 
- (NSNumber *)instagramOnly {
    return [NSNumber numberWithBool:YES];
}

EDIT: I did some more investigation. ShareKit works as intended, and according to Instagram dev guidelines. If you set instagramOnly to NO, you see much more options. So it seems that Facebook app is also capable to share @"com.instagram.exclusivegram" UTI, which is not very nice from them. But, unfortunately, there is nothing we can do with it, except filing a bug report at Facebook.