Search code examples
iosfacebooktwittersharesharekit

Sharekit2.0: how can I directly share to facebook and twitter, rather than via UIActionSheet?


I'm using the latest Sharekit2.0 on a project.

Two buttons are listed ("Get votes on Facebook" and "Share on twitter") as attached, so I don't need a UIActionSheet to prompt. How can I directly share text information to facebook and twitter respectively.

Thanks


Solution

  • could you please try the following:

    #import "SHK.h"
    #import "SHKFacebook.h"
    #import "SHKTwitter.h"
    

    then for facebook

    -(IBAction)forFacebook:(id)sender;{
        NSString *someText = @"This is a blurb of text I highlighted from a document.";
        SHKItem *item = [SHKItem text:someText];  
    
        [SHKFacebook shareItem:item];    
    
    }
    

    for twitter

    -(IBAction)forTwitter:(id)sender;{
        NSString *someText = @"This is a blurb of text I highlighted from a document.";
        SHKItem *item = [SHKItem text:someText];  
    
        [SHKTwitter shareItem:item];    
    
    }
    

    please give me a feedback, thanks.