swiftvkvk-sdk

Get VK user avatar in Swift


I know how to get user email address in vkSdkAccessAuthorizationFinishedWithResult method. How can I get his avatar image and other profile info?

I assume that i need to use VKRequest for this. Unfortunately i found no swift documentation for VK iOS SDK.


Solution

  • Ok, i finally found solution - you need to add this code inside vkSdkAccessAuthorizationFinishedWithResult method

    let request:VKRequest = VKRequest(method: "users.get", andParameters: ["fields":"photo_50", "bdate"], andHttpMethod: "GET" )
    
    request.executeWithResultBlock({ response in
           print(response.json)
        }, errorBlock: {
            (error) -> Void in
            print("error")
    
    })