2014-02-19 56 views
0

我寫這個代碼來獲得追隨者的ID列表:iOS版Twitter的API沒有返回的追隨者

+ (void)getTwitterFriendsIDListForAccount:(ACAccount *)account withHandler:(TWFriendsListHandler)handler 
{ 
    NSMutableString *paramString = [[NSMutableString alloc] init]; 
    NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1.1/followers/ids.json"]; 
    NSDictionary *params = @{@"screen_name" : account.username}; 

    SLRequest *twRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter 
               requestMethod:SLRequestMethodGET 
                 URL:url 
               parameters:params]; 
    [twRequest setAccount:account]; 
    [twRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { 
     if (error) { 
      handler(nil, error); 
     } 

     NSError *jsonError = nil; 
     NSDictionary *twitterFriends = [NSJSONSerialization JSONObjectWithData:responseData 
                     options:NSJSONWritingPrettyPrinted 
                     error:&jsonError]; 
     NSArray *IDlist = [twitterFriends objectForKey:@"ids"]; 
     int count = IDlist.count; 
     for (int i = 0; i < count; i++) { 
      [paramString appendFormat:@"%@", [IDlist objectAtIndex:i]]; 
      if (i < count - 1) { 
       NSString *delimeter = @","; 
       [paramString appendString:delimeter]; 
      } 
     } 
     [self getFollowerNameFromID:paramString forAccount:account withHandler:handler]; 
    }]; 
} 

帳戶參數從ACAccountStore拍攝和IS NOT NULL,但我發現了一個空響應 - responseData包含0個字節。這個過去幾個星期前工作,所以我沒有看到問題可能是什麼。有什麼建議麼?

回答

0

問題是與網址。它需要使用https而不是http協議。

相關問題