Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to handle “sendDidFinish” in sharekit

I use sharekit with mail/twitter/facebook and I am really new to objective-c. sharekit works well and sends my images like it should.

in my app I have a screenshot function. I want the app to 'freeze' when a screenshot is taken, stopping to send any shake- or touch-event to the scene behind the sharekit-action. in my screenshot-layer I have three buttons which call the shareItem-methods of their specified service, like

[SHKTwitter shareItem:item];

vereything works fine 'till here. but now when the sending is finished (or canceled or errored) I need the app to 'unfreeze', sharekit should tell my app that it is allowed to listen to any touch- or shake-action again.

I am sorry but I think I don't understand the concept of using the delegate here. I mean, is 'sendDidFinish' meant to be inside a delegate? and if so, how could I tell sharekit who is its delegate? or do I have to edit the send-service classes (like SHKItem or SHKFacebook) itself?

please don't downrate me for this question. I really want to get behind this mystery...

like image 647
headkit Avatar asked Mar 14 '12 17:03

headkit


1 Answers

SHKTwitter inherit from SHKOAuthSharer, who inherit from SHKSharer. SHKSharer has a delegate protocol called "SharerDelegate".

So you can use an instance of SHKTwitter, then set it's delegate as :

shkTwitterInstance.shareDelegate = yourDelegateObject.

And implement the delegate method

- (void)sharerFinishedSending:(SHKSharer *)sharer;.

Try that.

EDIT (OTHER, AND MORE POPULAR, SOLUTION)

Also, you can suscribe your object to "SHKSendDidFinish" notification from SHKTwitter object.

[[NSNotificationCenter defaultCenter] addObserver:yourObject selector:@selector(theMethodthatYouWantToExecuteWhenTheNotificationIsRaised:) name:@"SHKSendDidFinish" object:shkTwitterObject];
like image 65
LuisEspinoza Avatar answered Nov 10 '22 08:11

LuisEspinoza