Get the relationship status of user's Facebook friends - ios

This is what I'm using now:
if ([FBSDKAccessToken currentAccessToken]) {
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:#"/me?fields=id,name,friends{relationship_status}"
parameters:nil
HTTPMethod:#"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
NSLog(#"Result: %#", result);
}];
}
but the result contains an empty list of friends. I guess this list contains the friends that have installed this same app.
Using the Graph Tool Explorer I can get this list
GET /v2.3/me?fields=id,name,friends{relationship_status,gender}
How can I get this list in iOS?
Permissions that I'm calling are:
loginButton.readPermissions = #[#"public_profile", #"email", #"user_friends"];
***** UPDATE *****
Ok, I've read the confirmation: "Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app."
Has anyone used taggable_friends or something like that to get the list of friends making more requests later to get the information about each and every friend? Is this something Facebook can reject when submitting the app?

That's not possible, because all friends_* permissions have been removed. Please don't waste your time trying to find a workaround.
See
https://developers.facebook.com/docs/apps/changelog#v2_0
All friends_* permissions have been removed.

Related

how to post facebook fan page wall

I tried to post image in facebook fan page.
I am using below code:
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:#"/facebookPage_ID/photos"
parameters:#{ #"url": #"https://dncache-mauganscorp.netdna-ssl.com/thumbseg/378/378006-bigthumbnail.jpg",}
HTTPMethod:#"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
// Insert your code here
}];
Current image posts to facebook page successfully but image "did not post in facebook page wall" is shown in visitor post.
I want to show image in facebook page wall.
You need to use a Page Access Token instead of a User Access Token:
https://developers.facebook.com/docs/facebook-login/access-tokens/
http://www.devils-heaven.com/facebook-access-tokens/
The steps:
Get a User Token with the manage_pages and publish_pages permissions
Use /page-id?fields=access_token to get a Page Token for a specific Page

Get USER tagged and saved videos by graph api

I have two queries;
1- How can i get user's tagged videos as the below request to Graph API returns me nil on request :( and i have spend about thousands of minutes on searching for this issue but did not find the accurate answer or reason of this issue.
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:#"me/videos/tagged"
parameters:nil
HTTPMethod:#"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
// Insert your code here
NSLog(#"Result is:%#",result);
}];
2- How to make a call for user's saved videos on Facebook to Graph API?
I am Running FB SDK Version 4.20.2 and Graph API version 2.9.
Currently I am using a test account for this purpose and all videos are public.

Parameter for like count with facebook api V2.3

I am using this line of code for getting count of likes on facebook post
NSString *postId = #"1234567890_1234567890";
NSMutableDictionary* photosParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:postId,#"ObjectId",nil];
NSString * str = (NSString *) [[[FBSDKGraphRequest alloc] initWithGraphPath:#"/{object-id}/likes"
parameters:photosParams
HTTPMethod:#"GET"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if ([error.userInfo[FBSDKGraphRequestErrorGraphErrorCode] isEqual:#200]) {
NSLog(#"%#",[error localizedDescription]);
}
}];
but I am getting error of unsupported url, any one have Idea what parameter I use to get result. I am using updated version of facebook api
As
https://developers.facebook.com/docs/graph-api/reference/v2.3/object/likes
states, you need
The same permissions required to view the parent object are required to view likes on that object.
That means that the permission setting for Posts (https://developers.facebook.com/docs/graph-api/reference/v2.3/post) apply:
For page posts, public posts by the page are retrievable with any valid access token. Posts by people on the page, posts by people which mention the page, or targeted page posts (by language or geography, for example) may require a user or page token.
A user access token with read_stream or user_posts permission for any other posts
Are you sure you're adding an Access Token to your request?
You can request multiple posts at once like this:
/?ids={object_id1},{object_id2}&fields=id,created_time,likes.summary(true).limit(0)

how to get all friends in facebook using graph api v2.0 (ios)?

I'm trying to get user's list of friends by authanticate user and successfully when I use this code:
self.loginView.readPermissions = #[#"public_profile", #"user_fridends", #"email"];
[FBRequestConnection startWithGraphPath:#"/me/taggable_friends"
parameters:nil
HTTPMethod:#"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(#"%#", result);
}];
But I cannot get list of friends when I trying to get list of friends by another account
https://developers.facebook.com/docs/graph-api/reference/v2.1/user/taggable_friends
Use of this edge must be reviewed by Facebook before it can be called on behalf of people who use your app.
Without approval, it will only work for users with a role in the App (Admin/Dev/Tester). The proper way to get the friends is /me/friends, and it will only return those who authorized your App too.
Also, it is "user_friends", not "user_fridends".

How to get all the friends of the user in FB using iOS SDK

FaceBook launched new API from version 2.0 and asking users to upgrade to new SDK.
In my iOS application (which is not a game), user signs in using Facebook. In side the application I have an option to show all the FB friends of the user (friends who are not using the application).
I tried the below code which returns the friends who are using the application:
[FBRequestConnection startWithGraphPath:#"/me/friends"
parameters:nil
HTTPMethod:#"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(#"%#", result);
}];
And below code is not working in my application, because my app is not a game. As per FB, below code works only for Games.
FBRequest *request = [FBRequest requestWithGraphPath:#"me/invitable_friends"
parameters:#{#"fields":#"name,installed,first_name"}
HTTPMethod:#"GET"];
[request startWithCompletionHandler:^(FBRequestConnection *connection,
id result,
NSError *error){
NSLog(#"%#", result);
}];
Is there any other alternative to fetch the friends of the user?
According to the document, with the new Facebook Graph API 2.0, there is no way to fetch all friends.
Friend list now only returns friends who also use your app: The list
of friends returned via the /me/friends endpoint is now limited to the
list of friends that have authorized your app

Resources