I've seen many examples on how to make a facebook-Wallpost using the facebook-SDK for iphone (see here for example). They all go something like this:
[facebook dialog:#"feed" andParams:params andDelegate:self];
However I dont want the Facebook-Dialog to appear, but instead use my own dialog. Anyone ran into the same issue before?
Don't use
[facebook dialog:#"feed" andParams:params andDelegate:self];
This line will pop-up the FB-Dialog in order to avoid this first pop-up your custom dialog and then call the following action on done button (Or whatever you want to call it)
-(void) myCustomDialogPostButtonAction:(NSString *)msg
{
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
msg, #"message",
nil];
[facebook requestWithGraphPath:#"me/feed"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
I hope this helps.
Related
I want to post an image from my iPhone app directly to my wall. with out using an image url, with the actual UIImage or NSData.
On the recent FacebookSDK, I can post like:
[FBRequestConnection startWithGraphPath:#"me/photos"
parameters:params ..
and pass NSData of the image in params
but for older version FBConect.h can I have similar option? the one I know so far is by passing the image url as part of the parameters dictionary.
Thanks,
you can post image on your facebook timeline Wall like this way may be its helps you First you need to get permission to post Photo on wall in yourViewDidLoad Method like:-
NSArray* permissions = [NSArray arrayWithObjects:#"publish_stream", #"user_photos", nil];
[facebook authorize:permissions];
now to Post image At your Button Click or your logic like:-
-(IBAction)ActionPostWallPhoto
{
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
ImageView.image, #"picture",
nil];
[facebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
i am currently develop an app in which i need to add friend's from facebook friend list using new facebook graph API.
This is my code:
_permissions = [[NSArray arrayWithObjects:
#"read_stream", #"publish_stream", #"offline_access",#"read_friendlists",nil] retain];
[facebook authorize:_permissions];
facebook = [[Facebook alloc] initWithAppId:#"fbid" andDelegate:self];
[facebook requestWithGraphPath:#"me" andDelegate:self];
[facebook requestWithGraphPath:#"me/friends" andDelegate:self];
NSMutableDictionary*params = [NSMutableDictionary dictionaryWithObjectsAndKeys:#"4",#"uids", #"name", #"fields", nil];
[facebook requestWithMethodName:#"user.getInfo" andParams:params andHttpMethod:#"GET" andDelegate:self];
but every time it give me error in console
please help me...
Here you have a code sample that fetches the friends info:
[facebook requestWithGraphPath:#"me/friends"
andParams:[ NSDictionary dictionaryWithObjectsAndKeys:#"picture,id,name,link,gender,last_name,first_name",#"fields",nil]
andDelegate:self];
Remember to:
implement the proper delegate methods
You must call authorize before fetching the friends information. This way the user will be able to login first.
I hope this helps, cheers
I think you should swap. Otherwise it's not working.
this is correct way:
facebook = [[Facebook alloc] initWithAppId:#"fbid" andDelegate:self];
[facebook authorize:_permissions];
$friend_list =json_decode(file_get_contents("https://graph.facebook.com/$uid/friendlists?access_token=$access_token"),true);
$friend_list_array = $friend_list['data'];
foreach($friend_list_array as $key=> $value){
$inner_array_name[$value['id']][]=$value['name'];
}
Facebook recently added photo-tagging capabilities to its Graph API:
http://developers.facebook.com/blog/post/509/
I am using FbConnect on iPhone to upload a picture and tag my page inside it.
So, my first call is:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.imageToPost, #"picture",
#"My caption!", #"name", #"tags",
nil];
[self.theFacebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
This correctly returns:
{
id = 2092859844825;
}
Then I make another call:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
FACEBOOK_PAGE_ID,#"to",
#"160",#"x",
#"240",#"y",
nil];
[self.theFacebook requestWithGraphPath:[NSString stringWithFormat:#"%#/tags",photoId]
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
Then I get:
{contents = "OAuthException"}
{contents = "(#121) Invalid photo id"}
But what ID does it expect from me?
Submitting the same request in GET method, it doesn't give the error, so I think the id is correct. Any ideas??
What permissions do you have set? Check you have the user_photos permission
I am trying to retrieve my online friends and I am getting this error:"An active access token must be used to query information about the current user."
This is my method:`-(IBAction)act:(id)sender{
NSArray* permissions = [[NSArray arrayWithObjects:
#"user_online_presence", #"friends_online_presence", nil] retain];
[facebook authorize:permissions delegate:self];
[facebook requestWithGraphPath:#"me/friends" andDelegate:self];
NSLog(#"dd");
NSLog(#"%#",facebook.accessToken);
}
`
What I am doing wrong here?
you are not waiting for the authorization to complete.
You will need to implement the didLogin delegate method, and
[facebook requestWithGraphPath:#"me/friends" andDelegate:self];
should go only after didLogin was called.
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 ;)