I'm trying to get the user's events and his friends events by the Graph API.
first, is there any other option getting all the friends events except sending new query for every one of them? (even if it exists in other protocols)
for( NSDictionary *friend in friends ) {
NSLog(#"sending events for %#", [friend objectForKey:#"id"]);
[facebook requestWithGraphPath:
[NSString stringWithFormat:#"%#/events&since=today&until=tomorrow&limit=10", [friend objectForKey:#"id"]]
andDelegate:self];
}
second, can I get ALL the user's events and not just what he has marked attendance status for?
Thanks!
First of all you have to take Extended Permission of user_events and friends events. As for as your second part of question is concerened you can query to event_member table to get status. hope it will work
Related
I want to tag a friend in a post which I am posting on my wall , just wanted to know what permissions are required...?
I am using the following code...
For permissions..
NSArray *permissions = [[NSArray alloc] initWithObjects:
#"friends_online_presence",
#"read_stream",
#"email",
#"publish_stream",
nil];
[self.appDelegate.facebook authorize:permissions];
[permissions release];
and to post
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Test 2",#"message",
#"100004311843201,1039844409", #"to",
nil];
[self.appDelegate.facebook requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];
This gets posted on wall successfully but the profile ids are not included...
Though its in PHP here is bug report which says it is problem in Graph API while posting status update and tagging friends is not working properly.
It says that it will post status update but tagging is not working.
EDIT:
As discussed with OP in comments, adding place field attached to parameters it is working.
I think this should help you:
To mention a user in a user message, place this string inline with the message: #[userID] or #[profileUrl]. This creates an inline hyperlink to the profile of the mentioned friends and sends them a notification that they have been tagged.
Taken from: https://developers.facebook.com/docs/technical-guides/opengraph/mention-tagging/
For tag friends in Facebook friends id are required to tag in post etc.
customer friend picker is better for tag friends.
see below Facebook sample
https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851564_497226807066458_2037734970_n.png
for this purpose us this graph api taggable_friends to get tag able friends
for more detail visit this link and read tag section (Mention Tagging is suite for your requirements)
mentiontagging detail info
I would like my iPhone app to be able to post a static message to a user's friend's facebook wall. Something like it shows the static message up above, and then a place to type in friends name and shows suggested friends. Is this done through graph api, or is there a key of permissions that the POST method can use?
Looks like this might be what you are after.
From the link:
"You just have to send your friend's Facebook ID as a parameter under the key "target_id".
set a parameter under the key #"target_id" on the parameters dictionary (when invoking dialog:andParams:andDelegate: on the Facebook object).
Here you have a sample post using the new sdk (the one that uses graph api):
NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:#"Some text" forKey:#"user_message_prompt"];
[params setObject:#"another text" forKey:#"action_links"];
[params setObject:#"Yet another text" forKey:#"attachment"];
[params setObject:#"SOME FACEBOOK ID" forKey:#"target_id"];
//At some point you need to create the following Facebook instance
[facebook dialog: #"stream.publish"
andParams: params
andDelegate: self];
you first need to request the friend list and then provide an interface in your app where user could select which friend's wall he want to write on... :)
afterwards, you can pass the selected friends id to the dialog you are presenting to the user... Atleast I am used to do it this way and it seems to be a pretty standard way of publishing something on user's wall...
hope it helps
I'm programming my own iPhone game and since I don't want the users to pay for my levels, I'd like to allow them to post something on their FB or twitter timeline. Once it's done, I'd like to unlock the level for free, and do that for each levels pack.
Anyone has an idea on how to do this ? I know I can use Facebook API for iOS to post a status, but how can I ensure the action has been done ?
Each post or tweet has a confirmation delegate method. Add an NSNotification to unlock your level on confirmation completion.
You can do this, it's easy using graph api for FB.
You can say user to post message hardcoded in you code and you receive response from api that message is posted on his wall then you can unlock the level.
Also if you want that user can't edit message then you need to post message in background and it easy like below code.
NSMutableDictionary *dictPara = [[NSMutableDictionary alloc] init];
[dictPara setObject:objSelGameStep.smsg forKey:#"message"];
[dictPara setObject:#"status" forKey:#"type"];
[facebook requestWithGraphPath:#"me/feed" andParams:dictPara andHttpMethod:#"POST" andDelegate:self];
i hope this may help you.
I am creating an app and would like people using the app to find friends using the same app on Facebook. Any help on this would be great.
I know this can be done. I have seen it on Instagram and Tiger Woods 12.
Once you've authorised the user and obtained an access token, you can quickly determine which of their friends have already authorised your app with a call to /me/friends?fields=installed
For the users' friends who have already authorised the app, the result will look like this:
{
"installed": true,
"id": "{USER_ID_GOES_HERE}"
},
and for the users who have not already authorised the app, the result will look like this:
{
"id": "{USER_ID_GOES_HERE}"
},
If you're doing this in the iOS SDK you won't see that exact return value, but the SDK should put the results into a data structure you can use, and check for the presence of the 'installed' item
You can also request additional User object fields other than just 'installed', but this is just a quick example to show you how to get the list of friends that use the app
I have solved this problem in very easy way
Step 1= first download FbGraph API
Step 2= use this code for authentication
NSString *client_id = #"XXXXXXXXXXXXXX";// App id
//alloc and initalize our FbGraph instance
self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];
//begin the authentication process.....
[fbGraph authenticateUserWithCallbackObject:self andSelector:#selector(fbGraphCallback:)
andExtendedPermissions:#"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];
Step 3= Copy fbGraphCallback: Method from sample code and put in your controller
Step 4= Use this code to get Friends and it will give u the list of friend and who have same app install They look like
{
"installed": true,
"id": "{USER_ID_GOES_HERE}"
},
Code is =
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];
[variables setObject:#"installed" forKey:#"fields"];
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:#"me/friends" withGetVars:variables];
NSLog(#"getMeinstalled Friends: %#", fb_graph_response.htmlResponse);
Thats it!!!!!!!!
I know 'iphone' is tagged in the question, but still this answer might help others who will reach here:
The FQL query to get (just) the ids of all user's friends who are also users of the app is:
SELECT uid FROM user WHERE is_app_user=true AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
I am receiving the following graph response when checking users into Facebook using the Facebook Graph API. I am using the facebook-ios-sdk within my iPhone application to do this.
{"error":{"type":"OAuthException","message":"An unexpected error has occurred. Please retry your request later."}}
I have not made any changes to my code today and I know for a fact (database logs, etc) that their have been successful checkins yesterday.
I'm asking the SO community whether or not they have received similar errors and how they attempted to resolve them?
I have already tried the following:
Revoked access to my application via Facebook.
Reset my offline_access token by forcing Facebook to generate a new one.
Keep in mind my application successfully shares via peoples Facebook walls as well and this is working as expected without any problems.
I request the following permissions from my users:
#"offline_access", #"publish_stream", #"publish_checkins", #"email"
EDIT:
Okay, so this is quite strange and I'm thinking that it's an error on Facebook's end.
I use the following code to tag friends in the checkin:
if ([self.selectedFriends count] > 0) {
[variables setObject:[self.selectedFriends componentsJoinedByString:#","] forKey:#"tags"];
}
fb_graph_response = [fbGraph doGraphPost:#"me/checkins" withPostVars:variables clientId:accessToken];
self.selectedFriends is simply an NSMutableArray of Facebook profile ID's separated by commas, which is what the graph API says to use and remember this has been working fine for months.
http://developers.facebook.com/docs/reference/api/checkin/
If I remove the [variables setObject:[self.selectedFriends componentsJoinedByString:#","] forKey:#"tags"]; then the checkin works just fine for me.
It fails every time I tag one or more friends. Is anyone else receiving the same error when tagging friends in a checkin?
UPDATE 1:
Looks like other people are receiving the same problem relating to Groups:
http://forum.developers.facebook.net/viewtopic.php?pid=349396
I wonder if there's a bug at the moment relating to Checkins.
I've posted a bug:
http://bugs.developers.facebook.net/show_bug.cgi?id=18134
UPDATE 2:
Facebook were able to reproduce the bug and they're now looking into it.
i m using checkins in one of my applications , Regarding your issue ,
Yes , you are right , i had this OAUTH Exception only when sometimes you made checkins continuously with tagging friends,
Also allow permissions like #"user_checkins", #"friends_checkins", in your application
please check this link :
http://tylerwhitedesign.com/how-to-check-in-using-the-facebook-ios-sdk-and-graph-api
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[dictionary objectForKey:#"place"], #"place", //The PlaceID
coordinates, #"coordinates", // The latitude and longitude in string format (JSON)
message, #"message", // The status message
tags, #"tags", // The user's friends who are being checked in
nil];
[_facebook requestWithGraphPath:#"me/checkins" andParams:params andHttpMethod:#"POST" andDelegate: postCheckinRequestResult];
Hope this helps!