Form of fbrequest - iphone

I'm using fbconnect in my app to connect to Facebook. Whenever i code a feature, I must google to find the form like below:
//////
NSString *event = #"{\"name\":\"A party\",\"start_time\":\"1215929160\",\"end_time\":\"1215929160\",\"location\":\"Somewhere\"}";
NSDictionary *params = [NSDictionary dictionaryWithObject:event forKey:#"event_info"];
[[FBRequest requestWithDelegate:self] call:#"facebook.events.create" params:params];
/////
I wonder how can I know the format of string "event", or key #"event_info", or #"facebook.events.create". I try to find document of fbconnect that talk about format above but ... Anybody can help me about this. Thanks

It's here:
events.create

Related

How can I get the email id list using Twitter Integration in the iPhone SDK?

How can I get the Twitter email id list in the iPhone sdk?
I'm using MGTwitterEngine and when I try the following method:
NSString *str2 = [_engine getUserInformationForEmail:#"yw8181#gmail.com"];
NSLog(#"User Email Id:--->%#",str2);;
so its return 0E156D0F-3E56-4935-9BE9-2A34786545ED so how can i display in tableView
I'm not getting email id list, please help me solve this issue.
What happens when you log it?
I'm guessing that it doesn't return an NSString, but another datatype like an NSArray?
Try this:
NSArray *myArray = [_engine getUserInformationForEmail:#"yw8181#gmail.com"];
for (NSString *item in myArray) {
NSLog(#"%#",item);
}

How to post photos to facebook iphone fbconnect

Hi I'm using FBConnect to post to facebook, now I need to post photos from library or taken with the cam, does anyone has a clue how to do this ?? I've searched in google but I can't find a piece of code that works for me. I've found this method:
FBRequest *uploadPhotoRequest = [FBRequest requestWithDelegate:self];
[uploadPhotoRequest call:#"photos.upload" params:args];
but in my fbconnect i have this one instead: (I think the version of the api is different)
[_fbRequest call:(NSString *) params:(NSDictionary *) dataParam:(NSData *)];
Also I'm using this method to post to the wall:
- (void)postToWall { FBStreamDialog* dialog = [[[FBStreamDialog
alloc] init] autorelease];
dialog.userMessagePrompt = #"Enter your message:";
dialog.attachment = [NSString stringWithFormat:#"{\"name\":\"%# Esta conectado desde TravelFan iPhone App\",\"caption\":\"Viajar te cambia la vida\",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"http://www.travelfan.com.mx/content/templates/default/images/logo_travel.jpg\",\"href\":\"http://www.travelfan.com.mx/\"}]}",
_facebookName];
dialog.actionLinks = #"[{\"text\":\"Obten TravelFan
App!\",\"href\":\"http://www.travelfan.com.mx/\"}]"; [dialog show];
}
In this method I can send an image but not as a photo its just for the app logo and its an attachment.
Can anyone tell how to post photos to the wall pls ??
Any help is apreciated XD.
You can now post photos on your wall with requestWithGraphPath method as follows.
NSData *yourImageData= UIImagePNGRepresentation(yourImage);
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Your text with picture", #"message", yourImageData, #"source", nil];
[facebook requestWithGraphPath:#"/me/photos" andParams:params andHttpMethod:#"POST" andDelegate:self];
The requestWithGraphPath method is non-blocking - meaning it will complete before the photo is actually uploaded. You'll know when the photo is finished uploading by implementing the following in your FBRequestDelegate

Calling Facebook API method from iPhone SDK

I got Facebook Connect working and all and it's loading up the user's friends list with perfection. So now I have the logged in user's UID and the friend's UID. How would I go about calling their users.getInfo method from the SDK? The example below is what they give me to set a status, but I don't know how I can transform it to work with what I need. Especially the NSDictionary part. Please help!
Example Code -
NSString *statusString = exampleTextField.text;
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
statusString, #"status",
#"true", #"status_includes_verb",
nil];
[[FBRequest requestWithDelegate:self] call:#"facebook.Users.setStatus" params:params];
Thanks for any help!
According to the documentation at http://github.com/facebook/facebook-iphone-sdk you have to use the old API calls and the Facebook Query Language (fql) to pull information via the SDK. So you'd have to identify what information you want (or pull in a bunch and separate).
Here's the example they give to pull a user's name.
- (void)getUserName {
NSString* fql = #"select name from user where uid == 1234";
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:#"query"];
[[FBRequest requestWithDelegate:self] call:#"facebook.fql.query" params:params];
}
- (void)request:(FBRequest*)request didLoad:(id)result {
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [user objectForKey:#"name"];
NSLog(#"Query returned %#", name);
}
getUserName shows you the data pull which you could adapt to create new routines--but the request:didLoad: function would need some internal switching.

Publish to Facebook wall from iPhone application

No Matter what i do, i cannot get a post published to an application page wall (the app being logged into) via an iPhone application. I'm able to log in using FBLoginDialog and then retrieve data to populate a tableview, however when i click a button to publish some test content it doesn't work. Here is the button action:
- (void)compose:(id)sender;
{
NSString *tid=#"115372005166292";
NSString *body = #"My Test";
NSArray *obj = [NSArray arrayWithObjects:body,[NSString stringWithFormat:#"%#", tid],nil];
NSArray *keys = [NSArray arrayWithObjects:#"message",#"target_id",nil];
NSDictionary *params = [NSDictionary dictionaryWithObjects:obj forKeys:keys];
[[FBRequest requestWithDelegate:self] call:#"facebook.stream.publish" params:params];
}
I have also used the FBStreamDialog which works, however i'm faced with two issues there. The dialog lacks customization and i'm unable to handle the callback when the item is posted (e.g. reload the tableview)
I've been searching the internet and all of the examples are similar to the code above, so i'm not sure what i could be missing.
Thanks
You need to ask for extended permissions. After login show this:
FBPermissionDialog* dialog = [[[FBPermissionDialog alloc] init] autorelease];
dialog.delegate = self;
dialog.permission = #"status_update";
[dialog show];
Doc: http://github.com/facebook/facebook-iphone-sdk/#readme

iphone : FBConnect Auto post to user wall

i want to auto post to a user wall from my iphone applications ( without that "publish" "skip" dialog box ). how i can do that ?
the following should be called in the class that implements FBSessionDelegate and FBRequestDelegate:
Facebook *_facebook = [[Facebook alloc] initWithAppId:kAppId];
NSArray *_permissions = [[NSArray arrayWithObjects:
#"read_stream", #"offline_access",nil] retain];
[_facebook authorize:_permissions delegate:self];
And that is the call for fb post (should be used in the same class):
NSString *message = #"This is the message I want to post";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, #"message",
nil];
[_facebook requestWithMethodName:#"stream.publish"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
If you want to post a message on the wall of other user you should include "uid" parameter in your params dictionary. Please consult http://developers.facebook.com/docs/reference/rest/stream.publish/
P.S. There are all the necessary examples in the iPhone Facebook connect SDK sample code, so please do not afraid to investigate just a little bit ;)