Monday, September 5, 2011

ShareKit with New graph API

Share Kit is wonderful framework for all iPhone developers , but one problem is that it doesn't support new facebook graph API and it's integration to iPhone .

So after searching for heaps of messages , i stumbled upon share Kit ported with Graph API by Idea shower
https://github.com/ideashower/ShareKit

Following instructions provided I was able to integrate my project with sharekit supporting Graph API .

/// steps to follow

1) download the idea shower port of sharekit with graph API
2) find the ShareKit folder in the extracted directory .
3) copy these files as group into your project
4) open SHKConfig.h file and search for #define SHKFacebookAppId , place here your facebook APP id [ you can create APP @ https://developers.facebook.com/apps]
5) Now find your project's info.plist . Here you need to add the URL scheme under URL types. Hierarchy should look like URL types -->Item )--> URL Scheme -->Item 0 for Item 0 add the value fbXXXXX [XXXXX is your Facebook APP ID ] if this is not given then after sign on you will not be able to return back to the application .

6) By default share kit doesn't throw the sign in notification , you need to make some modifications, find - (void)fbDidLogin in SHKFacebook.m and add the notification [[NSNotificationCenter defaultCenter] postNotificationName:@"faceBookAuthenticated" object:nil];
7) You should be able to catch this notification in your app code and take needed action .

8) To login without sending any content do like below , and catch the notification .

SHKFacebook *temp = [[SHKFacebook alloc] init];
if(![temp isAuthorized])
[temp authorize];

9) ShareKit has one more issue , when you call the above after successful login it tries to send some data by calling [self share]; in the fbDidLogin, so you will see one spinner spinning endlessley . This can be corrected by looking in - (BOOL)send of SHKfacebook , here move the line [self sendDidStart]; into if statements .

No comments:

Post a Comment