访问Twitter时间线帐户出了什么问题? [英] What goes wrong to access twitter timeline account?

查看:126
本文介绍了访问Twitter时间线帐户出了什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下代码来访问Twitter时间线。它没有从服务器收到任何数据。这里出了什么问题?

I tried the fallowing code to get access twitter timeline. It doesn't received any data from the server.What went wrong here?

 ACAccount *twitterAccount=[arrayOfAccounts lastObject];

            NSURL *requestURL=[NSURL URLWithString:@"http://api.twitter.com/1/statuses/user_timeline.json"];

            NSMutableDictionary *parameters=[NSMutableDictionary new];
            //[parameters setObject:@"100" forKey:@"count"];
            //[parameters setObject:@"1" forKey:@"include_entities"];

            SLRequest *post=[SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:requestURL parameters:parameters];

            post.account=twitterAccount;

            [post performRequestWithHandler:^(NSData *response, NSHTTPURLResponse *urlResponse, NSError *error) {

                self.array=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:&error];
                if(self.array.count !=0)
                    NSLog(@"%@",self.array);
                else
                    NSLog(@"No Data Recived");

提前致谢。

推荐答案

Twitter建议使用版本1.1而不是建议v1。在版本1.1 api https中,请尝试使用此URL https://api.twitter.com /1.1/statuses/user_timeline.json 已设置此网址 http:// api .twitter.com / 1 /状态/ user_timeline.json 。这项工作很好。

Twitter has advice to use Version 1.1 not advice v1. In version 1.1 api https,So try to use this url https://api.twitter.com/1.1/statuses/user_timeline.json instated of this url http://api.twitter.com/1/statuses/user_timeline.json. This work's fine.

这篇关于访问Twitter时间线帐户出了什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆