简体   繁体   English

在iPhone应用程序的Twitter中发送推文,获取请求失败错误

[英]sending the tweet in twitter in iphone app, getting the request failed error

Iam developing Iphone applications. Iam正在开发Iphone应用程序。 i have integrated twitter in to my app, it is good up to login into twitter (authentication), but when we call method [engine sendUpdate] (for sending tweet), it says the follwing error has occurred. 我已经将twitter集成到我的应用程序中,可以登录到twitter(身份验证)是很好的选择,但是当我们调用方法[engine sendUpdate](用于发送tweet)时,它表示发生了以下错误。

Request CFE50DC4-02A0-46C1-BFF9-3F1F2E325C29 failed with error: Error Domain=HTTP Code=404 "The operation couldn't be completed. (HTTP error 404.)" 请求CFE50DC4-02A0-46C1-BFF9-3F1F2E325C29失败,并出现错误:错误域= HTTP代码= 404“操作无法完成。(HTTP错误404。)”

Please tell me the solution. 请告诉我解决方案。

Thanks 谢谢

You'll need to upgrade your application to use the correct URLs. 您需要升级您的应用程序以使用正确的URL。

In the case of API resource URLs, you want URLs that look like https://api.twitter.com/1/users/lookup.json 对于API资源URL,您希望URL看起来像https://api.twitter.com/1/users/lookup.json

In the case of OAuth negotiation URLs, you want URLs that look like https://api.twitter.com/oauth/request_token 对于OAuth协商网址,您需要的网址看起来像https://api.twitter.com/oauth/request_token

Source: https://dev.twitter.com/discussions/2359 (I did not check it personally, Posting so that it may help others) 来源: https : //dev.twitter.com/discussions/2359 (我没有亲自检查,请发帖以便对他人有所帮助)

...i checked, (worked for me) ...我检查了(为我工作)

Replace: #define TWITTER_DOMAIN @"twitter.com" 替换:#define TWITTER_DOMAIN @“ twitter.com”

With: #define TWITTER_DOMAIN @"api.twitter.com/1" 使用:#define TWITTER_DOMAIN @“ api.twitter.com/1”

in MGTwitterEngine.m 在MGTwitterEngine.m中

Similar Post: Error 403 while getFollowers : Twitter Iphone MGTwitterEngine 相似的帖子: getFollowers时出现错误403:Twitter Iphone MGTwitterEngine

HTTP 404 is a Not Found error, so it's likely that the URL you're using to send a tweet is incorrect. HTTP 404是“未找到”错误,因此您用来发送推文的URL可能不正确。

Check what you have in your code with the twitter documentation at http://dev.twitter.com 使用位于http://dev.twitter.com的twitter文档,检查代码中包含的内容

Version 1 of the API is now deprecated. 现在不推荐使用API​​版本1。 This document may describe an outdated version of the API. 本文档可能描述了API的过时版本。 Please move to Version 1.1 of the API as soon as possible. 请尽快移至API 版本1.1

Go through this document. 浏览该文档。

https://dev.twitter.com/docs/api/1.1/post/direct_messages/new https://dev.twitter.com/docs/api/1.1/post/direct_messages/new

Point to be noted 需要注意的地方

  • Api format should me json api格式应该我json
  • Api version v1.1 api版本v1.1
  • sender and receiver should follow each other. 发送者和接收者应该互相跟随。

Example Request 示例请求

POST : https://api.twitter.com/1.1/direct_messages/new.json POSThttps//api.twitter.com/1.1/direct_messages/new.json
POST Data : text=hello&screen_name=rajneesh071 POST数据 :text = hello&screen_name = rajneesh071

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

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