簡體   English   中英

在Twitter中獲取用戶名和個人資料圖片

[英]Get User Name and profile picture in twitter

我已經使用結構實現了Twitter登錄。 但沒有獲取個人資料圖片以及更多信息,例如電子郵件地址等。我已經為此實現了以下代碼

[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error)
{
    [objAppData hideLoader];

    if (session)
    {
        [objAppData hideLoader];
        NSLog(@"signed in as %@", [session userName]);
    }
    else
    {
        [objAppData hideLoader];
        NSLog(@"error: %@", [error localizedDescription]);
    }
}];

我只有用戶名和用戶ID。 從上面的代碼。 所以,我為此實現了另一個代碼

TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
NSURLRequest *request = [client URLRequestWithMethod:@"GET"
                                                 URL:@"https://api.twitter.com/1.1/account/verify_credentials.json"
                                          parameters:@{@"include_email": @"true", @"skip_status": @"true"}
                                               error:nil];
[client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {


    NSLog(@"%@",data);
     NSLog(@"%@",response);
     NSLog(@"%@",connectionError);




}];

但仍會獲得數據的空值並進行響應,並在connectionError中被禁止(403)。

來自Fabric的Mike。

403表示您無權獲取此信息。 需要特別請求請求電子郵件地址權限,因為您的密鑰需要為此額外的權限。 文檔中所述,“請求用戶的電子郵件地址要求您的應用程序被Twitter列入白名單。要請求訪問權限,請訪問https://support.twitter.com/forms/platform 。”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM