Reputation: 87211
I'm using ShareKit to allow users to share stuff from my app to Twitter and Facebook. After the user shared the object, I would like to get my app notified about it, in order to pass an API call to my server - so it can handle notifying the users "your friend just shared something, look it up!".
Facebook SDK allows to get a callback with information like the post ID. I'm wondering how to achieve something like this when using ShareKit 2.0 - should I override some methods of the Facebook and Twitter sharers?
Upvotes: 2
Views: 263
Reputation: 87211
It appears that modifying the ShareKit was the simplest (?) option.
In the SHKFacebook.m
file, in the
-(void)FBRequestHandlerCallback:(FBRequestConnection *)connection
result:(id) result
error:(NSError *)error
method the result parameter actually contains what I needed - it is a dictionary-like object that has the id
key - and the value is a string containing the FB id of the post:
result: {
id = "XXXXXXXX_YYYYYYYYYYYYYYYYYYY";
}
So what I actually did was adding a @property (nonatomic, strong) id sharingResult
to the base SHKSharer
class and setting it to the result
value just before calling the [self didFinishSending]
in FBRequestHandlerCallback
. This allows me to access the result in sharingDelegate later, in a - (void) sharerFinishedSending:(SHKSharer *)sharer
method.
Upvotes: 0
Reputation: 119031
All SHKSharer
s provide a delegate mechanism that you can use to be notified of the success / failure of the share (or authorisation). Check the superclass docs / .h file.
Upvotes: 2