Этот код не доступен нигде. Я много пробовал для этого кода, и я потратил много времени на это. Спасибо.
учаюBad Authentication data
ответ в твиттере друзей / список API. Я получаю ID пользователя, отображаемое имя, authToken и authTokenSecret при входе в систему.
func loadFollowers(userid:String) {
//let twapi = "https://api.twitter.com/1.1/followers/list.json?cursor=-1&user_id=\(session)&count=5000"
let twapi = "https://api.twitter.com/1.1/friends/list.json?cursor=-1&user_id=\(userid)&count=10"
let url2 = URL(string: twapi)!
print(url2)
URLSession.shared.dataTask(with: url2, completionHandler: { (data, response, error) in
//UIApplication.shared.isNetworkActivityIndicatorVisible = false
do {
let userData = try JSONSerialization.jsonObject(with: data!, options:[])
print(userData)
} catch {
NSLog("Account Information could not be loaded \(error)")
}
}).resume()
}
Выход:
{
"errors": [
{
"code": 215,
"message": "Bad Authentication data."
}
]
}
Какие параметры необходимы для отправкиfriends/list.json
API. В этом документе им даны все параметры, необязательные.https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list