2013-08-02 67 views
1

我試圖從twitter獲取朋友列表。從twitter獲取「朋友」列表

我想這個代碼:但我收到一個5鍵的NSDictionary:下一個遊標,前一個遊標,下一個遊標str,前一個遊標str和用戶:關鍵用戶有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]; 

} 

回答

0

您是否嘗試過,如果JSON有效?對於一些在線JSON查看器,我得到: JSON數據URL無法訪問。

+0

你得到這個,因爲你需要設置Twitter帳戶... – shadsauhduisad