FacebookAgent Update: Easily Run FQL, get User info, get/set permission and friend list!
GET THE LATEST CODE FROM HERE: http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/
PLEASE JOIN THE PROJECT
I am very grateful to all you people who posted feedback, mailed me inspiring notes and now reading the blog
Some of you were asking for shared object support so that facebook agent can be used from multiple view controllers. I really liked the idea and shared object is introduced in this release.
Besides, I have been invited to be a co-author on a new book by Hasin Hayder. This book will be on facebook connect and I will contribute the iphone integration chapter. I was really honored and thought to implement some more features in facebookagent and now there is option to get user info, friendlist and also you can now run fql
Here is a short description how to use in new way.
Firstly, On the AppDelegate class, initialize facebookagent shared object on applicationdidfinishlaunching method:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[[FacebookAgent sharedAgent] initializeWithApiKey:@"YOUR API KEY"
ApiSecret:@"YOUR_API SECRET"
ApiProxy:nil];
...
...
...
}
Now, set the facebookagent delegate to the view controller object in which you want to call a function:
[[FacebookAgent sharedAgent] setDelegate:self];
Then call the function you wish:
[[FacebookAgent sharedAgent] publishFeedWithName:@"Hellow world" captionText:@"how are you?" imageurl:@"http://amanpages.com/wordpress/wp-content/uploads/2009/12/logo2.png" linkurl:@"http://amanpages.com/" userMessagePrompt:@"What do i think:"];
Don’t forget to override the FacebookAgentDelegate method in the view controller class.
Some new delegate method is added like:
- (void) facebookAgent:(FacebookAgent*)agent permissionGranted:(FacebookAgentPermission)permission; - (void) facebookAgent:(FacebookAgent*)agent didLoadFQL:(NSArray*) data; - (void) facebookAgent:(FacebookAgent*)agent didLoadPermissions:(NSArray*) data; - (void) facebookAgent:(FacebookAgent*)agent didLoadInfo:(NSDictionary*) info; - (void) facebookAgent:(FacebookAgent*)agent didLoadFriendList:(NSArray*) data onlyAppUsers:(BOOL)yesOrNo;
And some new facebookagent function is also added:
- (void)getMyFriendList:(BOOL)onlyAppUsers; - (void)getPermissions; - (void)grantPermission:(FacebookAgentPermission)type; - (void)runFQL:(NSString*)fql; - (BOOL)hasPermission:(FacebookAgentPermission)type; - (NSString*)getUserName; - (NSString*)getUserProfileSquareImage; - (NSString*)getUserProfileImage;
I will be adding detailed tutorial soon, till then is it. Check out the code from
google project.
Personally I created a UIViewController subclass where all the delegate methods are added. Then extended this class by all the viewcontrollers needing facebook agent and overridden the required ones only.
I will really appreciate if you join this project and give any sort of update, bug report or even feedback.
Btw, do I need to mention again:
PLEASE REMEMBER THESE CODE IS NOT FULLY TESTED ON DEVICES AND MAY CRASH, USE IT ON YOUR OWN RISK!
Cheers.
-
coneybeare
-
coneybeare
-
多益高分技巧




(4.60 out of 5)