我在试着从推特上获取好友列表。
我正在尝试这段代码:但是我收到一个有5个键用户:下一个游标,上一个游标,下一个游标字符串,前一个游标字符串和用户:键user在value..but中有20个对象都是空的……
怎么了?
-(void) obterInformacoesTwitter {
NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/1.1/friends/list.json"];
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
[parameters setObject:_contaSelecionada.username forKey:@"screen_name"];
NSLog(@"Screen name %@", _contaSelecionada.username);
TWRequest *request = [[TWRequest alloc] initWithURL:url parameters:parameters requestMethod:TWRequestMethodGET];
request.account = _contaSelecionada;
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
if (responseData) {
NSError *error = nil;
NSDictionary* dict = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
NSArray *dictArray = [dict valueForKey:@"users"];
if([dict objectForKey:@"error"]!=nil)
{
}
else
{
}
}
}];
[parameters release];
[request release];
}发布于 2013-08-02 23:31:24
如果JSON有效,你试过了吗?对于一些在线JSON查看器,我得到的结果是: JSON数据URL不可访问。
https://stackoverflow.com/questions/18019256
复制相似问题