Getting user profiles

You can use the iOS SDK to get a user’s LINE profile information. User profiles include a user’s user ID, display name, profile media (image or video), and status message.

Before you begin

Make sure you have completed the following:

Getting user profiles

To get a user’s LINE profile information, call the getProfileWithCompletion method. If the call succeeds the user’s profile information is returned in the profile argument. If the API call fails, the error argument is a non-nil value. You can use the error argument to get an error code and description.

The following is an example of how to save the user profile information into NSStrings.

[apiClient getProfileWithCompletion:^(LineSDKProfile * _Nullable profile, NSError * _Nullable error) {

    if(error){

        NSLog(@"Error getting profile: %@", error.description);

    } else {

        LineSDKProfile * profileInformation = profile;

        NSString * displayName = profileInformation.displayName;
        NSString * userID = profileInformation.userID;
        NSString * statusMessage = profileInformation.statusMessage;
        NSURL * pictureURL = profileInformation.pictureURL;

        NSString * pictureUrlString

        // If the user does not have a profile picture set, pictureURL will be nil
        if(pictureURL){
            NSString * profilePictureUrlString = profilePictureURL.absoluteString;
        }

    }

}];

Executing the completion block in a different queue

getProfileWithCompletion executes its completion block in the main queue. To execute the completion block in a different queue, specify the queue by calling the getProfileWithCallbackQueue method.

[apiClient getProfileWithCallbackQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)
    completion:^(LineSDKProfile * _Nullable profile, NSError * _Nullable error) {
...
}];

For more information on using the iOS SDK, see the following pages.


Questions or suggestions?

If you have any questions about our LINE Platform products, first check our Q&A page on the Community site. To share suggestions or feature requests regarding the documentation or the LINE Platform, click the buttom below or create an issue on the LINE Platform feedback GitHub repository.