我用這個語句來從Twitter獲取用戶的電子郵件從Twitter獲取電子郵件時:斯威夫特3:無試圖用面料
I tested this code and it returns a nil for the email address! ` let client = TWTRAPIClient.withCurrentUser()
let request = client.urlRequest(withMethod: "GET",
url: "https://api.twitter.com/1.1/account/verify_credentials.json",
parameters: ["include_email": "true", "skip_status": "true"],
error: nil)
client.sendTwitterRequest(request) { response, data, connectionError in
if (connectionError == nil) {
do{
let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [String:Any]
print("Json response: ", json)
let firstName = json["name"]
let lastName = json["screen_name"]
let email = json["email"]
print("First name: ",firstName!)
print("Last name: ",lastName!)
print("Email: ",email!)
} catch {
}
}
else {
print("Error: \(connectionError)")
}
}
`
但不幸的是它返回零!
我已將我的應用列入白名單,並且我收到了來自Twitter團隊的一封電子郵件,告訴我所有授權都已授予我的應用。
Twitter API停止在其響應中返回emailID。 –