1

I'm trying to get the list of friends from twitter.

I'm trying this code: But i receive a NSDictionary with 5 keys: Next cursor, previous cursors, next cursor str, previous cursor str and users: the key user has 20 objects in value..but all are empty...

Whats wrong?

-(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];

}
4

1 に答える 1

0

JSONが有効かどうか試しましたか? 一部のオンライン JSON ビューアを使用すると、JSON データ URL にアクセスできません。

于 2013-08-02T15:31:24.223 に答える