简体   繁体   English

通过Native iOS App向Facebook用户发送个人消息

[英]Send personal messages to facebook user by Native iOS App

I want some way to send personal messages on facebook by Native iOS app. 我想通过Native iOS应用程序在Facebook上发送个人消息。 Personal in sense of it shouldn't be a wall post only intended person can see the message. 在个人意义上它不应该是一个墙上的帖子,只有意图的人才能看到这个消息。 We have tried to find the solution and we got the following solution but each one has problems. 我们试图找到解决方案,我们得到了以下解决方案,但每个都有问题。

  • Facebook Notification (Currently in beta mode) : This is only for web canvas app not for native iOS app. Facebook通知 (目前处于测试版模式):这仅适用于不适用于原生iOS应用的Web画布应用。
  • App request : We are able to send message to a person. 应用程序请求 :我们可以向某人发送消息。 But facebook is not showing any notification in notification area for it. 但Facebook没有在通知区域显示任何通知。 User can see this messages at "Games/Requests" but what we want is notification should be generated for it and it should be mobile compatible means iPhone should be able to get notification if FB account is configured. 用户可以在“游戏/请求”中看到此消息,但我们想要的是应该为它生成通知并且它应该是移动兼容的,这意味着如果配置了FB帐户,iPhone应该能够获得通知。

Any help will be appreciated. 任何帮助将不胜感激。

Three options for you, none brilliant: 三个选项,没有辉煌:

  1. Use the send dialog in a hidden web view using the URL form and use stringByEvaluatingJavaScriptFromString to populate the text field and fire the button.( https://developers.facebook.com/docs/reference/dialogs/send/ ). 使用URL表单在隐藏的Web视图中使用发送对话框,并使用stringByEvaluatingJavaScriptFromString填充文本字段并触发按钮。( https://developers.facebook.com/docs/reference/dialogs/send/ )。 They do say that this is not for this so they might shout at you if they find out. 他们确实说这不是为了这个,所以如果他们发现他们可能会对你大喊大叫。

  2. Use the chat API ( https://developers.facebook.com/docs/chat/ ). 使用聊天API( https://developers.facebook.com/docs/chat/ )。 That means you connect via XMPP and a message will either popup in the chat window or end up as a message if they are offline. 这意味着您通过XMPP连接,并且消息将在聊天窗口中弹出,或者如果它们处于脱机状态则以消息结束。 You can do this straight from the device - I did this once and it was horrendous but did eventually work. 你可以直接从设备上做到这一点 - 我曾经这样做过,这是可怕的,但最终确实有效。 Better IMHO would be to send a HTTP request to a server and PHP your way into Jabber as the FB sample shows. 更好的恕我直言将发送一个HTTP请求到服务器和PHP你的方式进入Jabber,如FB示例所示。

  3. You can apparently email [fb username]@facebook.com and it will pop up as a message. 您显然可以通过电子邮件发送[fb username] @ facebook.com,它会弹出一条消息。 You can use the standard Opengraph call to get the username. 您可以使用标准的Opengraph调用来获取用户名。

Martin 马丁

I have already figure out but late in answer to question. 我已经弄清楚但是在回答问题的时候已经很晚了。 After the lots of searching on google I found that we can achieve this using ChatAPI. 在google上进行大量搜索之后,我发现我们可以使用ChatAPI实现这一目标。

I found one source code on github : https://github.com/KanybekMomukeyev/FacebookChat 我在github上找到了一个源代码: https//github.com/KanybekMomukeyev/FacebookChat
In this code you can see implementation of chatAPI. 在此代码中,您可以看到chatAPI的实现。

@Martin has given all three good solution but 1 & 3 second option was not working. @Martin已经给出了所有三个好的解决方案,但是1&3秒选项无效。 3 option was giving error in sending email. 3选项在发送电子邮件时出错。 But I personally feel that 2 option is really good. 但我个人认为2选项非常好。 It should be the solution. 它应该是解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM