2013-03-12 120 views
0

我當前的代碼:Twitter的更新,以API 1.1

SLRequest *req = [SLRequest requestForServiceType:SLServiceTypeTwitter 
             requestMethod:SLRequestMethodGET 
                URL:[NSURL URLWithString:@"http://api.twitter.com/1.1/statuses/user_timeline.json"] 
              parameters:[NSDictionary 
                 dictionaryWithObjects:@[user] 
                 forKeys:@[@"screen_name"]]]; 
    [req performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { 
     if (urlResponse.statusCode == 200){ 
      id object = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil]; 
      completionBlock(object); 
     }else { 
      if (error == nil) 
       error = [API errorWithStatusCode:urlResponse.statusCode]; 
      errorBlock(error); 
     } 
    }]; 

我沒做對dev.twitter.com一個應用程序,但我不知道如何實現我從Twitter獲得的令牌。如何在沒有用戶詢問他們的Twitter帳戶的情況下更新到1.1?

回答

0

你需要authenticate您的要求來獲得用戶時間軸,請參閱本answer 這個答案是使用FHSTwitterEngineauthenticate請求,然後創建一個搜索查詢,就可以得到user_timeline,而不是搜索查詢。

希望它能幫助你^ _^