Michel
Michel

Reputation: 11755

Facebook SDK for iOS, private messages

After dowloading the Facebook SDK for iOS, I started to play with HelloFaceBookSample. I figured out how to post (on my TimeLine) text or pictures of my choice.

I would now like to be able to send text or a picture as a private message. I saw the friend picker button and code, but I do not quite see how I can pick a friend and then send him or her a given piece of text.

Where should I look at?

Thanks for any tip.

Upvotes: 2

Views: 5189

Answers (5)

Pavel Batashou
Pavel Batashou

Reputation: 1

You can use XMPP protocol for sending private messages. The best helpful framework for it is XMPPFramework - https://github.com/robbiehanson/XMPPFramework Read more here - https://developers.facebook.com/docs/chat/

Upvotes: 0

Phien Tram
Phien Tram

Reputation: 381

I've just discovered from Facebook API and see that it's possible to send direct message to a specific Facebook user by using Message Dialog. Check here for more details: https://developers.facebook.com/docs/ios/share#message-dialog

There's just a limitation: "Because the Message Dialog can only be presented when the native Facebook Messenger for iOS app is installed, the first thing we need to do is check if this is the case by using the FBDialogs canPresentMessageDialogWithParams: method."

Hope that help!

Upvotes: 4

flatronka
flatronka

Reputation: 1081

From the friend picker you can get a bunch of FBGraphUser object, which has a username property. If you append @facebook.com to this property, you will get the user facebook email addresses. Now you just write an email to this addresses and the user will get a private facebook message from your facebook account which is registered under your email address.

The only prerequisite that your email address needs to be attached to a facebook account.

Upvotes: 1

Divya Bhaloidiya
Divya Bhaloidiya

Reputation: 5064

This is not possible now, but there is a work around. You can engage with the user in the public realm and ask them to send you private messages, but you can't send private messages back, only public ones. Of course, this all depends on if the user gives you the correct permissions.

If you have given permission to access a person's friends, you can then theoretically post on that users wall with references to each one of the friends, asking them to publicly interact with you and then potentially privately message you.

Get Friends

#if authenticated
https://graph.facebook.com/me/friends
http://developers.facebook.com/docs/reference/api/user/

Post in the Public Domain

http://developers.facebook.com/docs/reference/api/status/

Get Messages sent to that user (if given permission)

http://developers.facebook.com/docs/reference/api/message/

Refer following : Send private messages to friends

Upvotes: 0

SAHM
SAHM

Reputation: 4179

It is not possible to send a private message via the Facebook SDK for iOS. The Send Dialog is not available for mobile devices.

Upvotes: 0

Related Questions