facebook 'invite friends' get successful answer but not notification (swift) - facebook

I need some help with the 'invite friends' functionality of facebook.
The code I am using to invite friends is:
let inviteDialog:FBSDKAppInviteDialog = FBSDKAppInviteDialog()
if(inviteDialog.canShow()){
let appLinkUrl:NSURL = NSURL(string: "https://fb.me/9999999999")!
let previewImageUrl:NSURL = NSURL(string: "http://example.com/myimage.png")!
let inviteContent:FBSDKAppInviteContent = FBSDKAppInviteContent(appLinkURL: appLinkUrl)
inviteContent.previewImageURL = previewImageUrl
inviteDialog.content = inviteContent
inviteDialog.delegate = self
inviteDialog.show()
}
When I do the test in my iPhone, It redirect me to the facebook app and list my friends, then I choose some of then, send the invitation and get the following result in the logs.
[didComplete: 1]
But my friends does not get the notification.
I am the administrator in the facebook console, one of the invite friends is in the developer role and the other one is in the tester role.
I created the appLink with facebook.
The configuration in my facebook console is:
Thanks!

Related

Facebook Login with button not requesting all needed read permissions

In my iOS app, I use FBSDKLoginButton to login user and request 4 permissions using the following code:
//create facebook login button
let fbLoginButton = FBSDKLoginButton(frame: loginButtonContainer.frame)
fbLoginButton.readPermissions = ["email","public_profile","user_photos","user_birthday"]
self.view.addSubview(fbLoginButton)
fbLoginButton.delegate = self
for some test users this works fine and all 4 permissions are requested, but for others - only email & public profile permissions are requested, with no mention of the other two.
any ideas as to a possible reason for the difference ?

Send Facebook apprequest from Windows Phone

I'm trying to send an apprequest from my Windows Phone 7.5 application to a Facebook friend to invite that friend to play a gameround.
According to Facebooks official documentation, a request should be performed via dialogs:
https://developers.facebook.com/docs/reference/dialogs/requests/
Unfortunately I cannot get this to work/show on Windows Phone.
Is there another way to send an apprequest to a known facebook user (I only need to send it to one user)?
I have tested to do it by invoking the following code:
FacebookClient fb = new FacebookClient(_appAccessTooken);
var arguments = new Dictionary<string, object>();
arguments["appId"] = Consts.FaceBookAppID;
arguments["title"] = "Play a gameround!";
arguments["message"] = "Would you like to play with me?";
fb.PostAsync("/user-id/apprequests", arguments);
This works, but:
1) The user will not get a proper notification, it will only be visible from the Applicationcenter notices.
2) The request will be sent from the application name, not from me (the user)
Does anybody know how to get this working?
II'm using the Facebook SDK for .NET (http://facebooksdk.net/)
Thanks in advance.

getting facebook pages liked by a friend

I'm using Django-social-auth for facebook login and Facepy to retrieve data from facebook.
Now I'm trying to get the list of all the pages liked by a user's friend. If I use:
graph.get('some_friend_id/likes')
I get an empty list of likes ( {'data': []} ).
I have added 'friends_likes' on my facebook app's User & Friend Permissions, and still it doesn't work.
my code looks like this:
instance = UserSocialAuth.objects.filter(user=request.user).filter(provider='facebook')
graph = GraphAPI(instance[0].extra_data['access_token'])
ps = graph.get('me/friends')
myfriends = ps['data']
frnd_id = myfriends[29]['id'] # getting a friend's ID
lk = frnd_id + '/likes'
frnd_likes = graph.get(lk)
print frnd_likes
A little help would be great. Thanks!

How to get ids of facebook invited friends by user in my asp.net4.0 web application

I am developing an ASP.NET application. I implemented Facebook JavaScript API in my application, for connect with Facebook and get FB friend list of user. I had done this successfully.
Now, I want to count how many friends are invited by user. Is it possible with facebook API. User can select multiple friends and i want to count how many friends selected and invited by user, Invited friends Id is bonus if We can get.
Please don't forget that facebook changed its Oauth settings for security reasons.
I'm also trying to get ids values after Send Invitation button clicked and page post back to
if (Request.Form["ids"] != null)
{
span1.InnerHtml = "ids";
//put success code here..
}
else
{
span1.InnerHtml = "oops no id";
}
if (Page.PreviousPage != null)
{
span1.InnerHtml = "ids";
//put success code here..
}
else
{
span1.InnerHtml = "oops no id";
}
but in this case program control always goes to else condition it means after page is post back form return null value.
Is there any way to get ids of invited friends.
Thanks.
If you using Facebook Requests to send invites (you really should, it's intended for this), the only way to get invited friends is via Facebook Requests Dialog callback:
FB.ui({method: 'apprequests', message: 'Whoa!'}, callback);
function callback(response){
// response.to now contain array of invited users ids
console.log('Invited friends ids', response.to);
if (response.request) {
console.log('Efficient Request id', response.request);
} else {
console.log('Requests Ids', response.request_ids);
}
}
There is no way to get request sent by user via Graph API or FQL, you only can get requests received by user. You may save all requests sent by your users and rely on this data if you need aggregated count of invitation sent...
Ok finally I resolve this issue and get invited friends ids..
As we know we use javascript sdk for FB connect so my solution is in concern of Java script:
Just make on change in your .js file where you put your facebook connect javascript code. Use Get or Request Method instead of Post Method in fb:request-form tag.
<script type="text/javascript>
var fbhtml = "<fb:serverFbml width=\"" + width_of_invitation_div + "\">
<script type=\"text/fbml\"><fb:fbml><fb:request-form action=" + window.location + " method="REQUEST" invite="true" type="" + type_of_fb_request_form + "" hold=" /><br mode="></fb:request-form></fb:fbml></script></fb:serverfbml>"
</script>
After invitation send to users selected friends you get ids[] in url.
you can get these ids through query string and split ids by comma(,) and store in array.
Hope this will help for other devs.

Inviting friends in facebook application

I have a facebook application that is published at facebook platform and i used facebook API to invite friends and i have succeeded in creating invitation form but the problem is that when u invite friend and send invitation and the invitation request sent to the user and the user accept it this friend appears again in the friend list that can be invited again
For example :
i have friend in my friend list named X and when i send invitation to him the invitation is sent and and X accept the invitation and when i try to send invitation again the friend X appears again in the list that i can select from to send invitation this means that may i send an invitation to this user (X) and he is already playing the game i need to know how to fix this problem so friends appear in the friend list (for invitation )only friends that not use the application.
My application at the following link
My Game application
visit it and see the problem exactly after inviting friends they will appear again is this normal in any game application?
thanks in advance for any reply
In FBML if you are using the friend-selector you can pass it an array exclude_ids. If you use the api to find the users' friends who are already using your app, you can exclude them this way.
This also works in the multi-friend-selector which sits inside an fb:request-form tag.
EDIT: the array of users to exclude can be obtained through the api call Friends.getAppUsers.
Following example uses the .NET Facebook Developer Toolkit. (mainly because that's how I've done it before!)
CODE BEHIND:
public string CURRENT_USER_FRIENDS = "";
//Call this function on pageload or where you like
private void PopulateFriendsData()
{
//exclude friends who already have the app from the inviter
string UsersToExclude = string.Empty;
IList<long> AppUserFriends = this.Master.API.friends.getAppUsers();
foreach (long L in AppUserFriends)
{
UsersToExclude += L.ToString() + ",";
}
CURRENT_USER_FRIENDS = UsersToExclude.TrimEnd(',');
}
PAGE:
<fb:multi-friend-selector
actiontext="Select the friends you want to invite"
rows="3"
exclude_ids="<%=CURRENT_USER_FRIENDS%>"/>