How to get user profile image from logged user with Twitter Kit/Fabric in iOS
The way to do it in swift is as follows:
Twitter.sharedInstance().APIClient.loadUserWithID( session.userID )
{
(user, error) -> Void in
if( user != nil )
{
println( user.profileImageURL )
}
}
I hope this helps.
Try below code to get profile image -
Swift 3
let twitterClient = TWTRAPIClient(userID: session?.userID)
twitterClient.loadUser(withID: (session?.userID)!, completion: { (user, error) in
print(user!.profileImageURL)
})
For those who are getting this error :
Value of type 'Twitter' has no member 'APIClient'
This helped me,
let twitterClient = TWTRAPIClient(userID: userID)
twitterClient.loadUserWithID(userID) { (user:TWTRUser?, error:NSError?) in
print(user?.profileImageURL)
}