1. Documents
  2. iOS SDK

API reference for the LINE SDK for iOS

Your application can fetch LINE users’ profile data and friend lists with the LINE SDK for iOS. With the LINE SDK for iOS versions 3 or higher, you can use certain APIs directly without accessing your server. This means you can use APIs without having to worry about access tokens because the SDK takes care of it automatically.

Getting access tokens

Certain APIs cannot be used via the LINE SDK for iOS. These APIs must be called from a registered server and require an access token. To use these APIs from your server, the access token must be transferred from the SDK to your server.

Access token information can be retrieved from the LineApiClient instance immediately after the authentication and authorization process. The example below shows how access tokens are retrieved.

After retrieving an access tokens, you will be able to use REST APIs from your server. Refer to REST APIs for more info.

Example

- (void)lineAdapterAuthorizationDidChange:(NSNotification*)aNotification
{
    LineAdapter *_adapter = [aNotification object];
    if ([_adapter isAuthorized])
    {
        LineApiClient *apiClient = [mAdapter getLineApiClient];
        NSString *accessToken = apiClient.accessToken;
        NSString *refreshToken = apiClient.refreshToken;
        // The above information will be sent to the backend server and processed accordingly.
    }
    else
    {
        ...
    }
}

Getting user profiles

The Profile API lets you retrieve user profiles.

Prerequisites

  • Access token with PROFILE permission issued.

Objects

The Profile API provides the following object which contains the user’s profile.

Property name Description
displayName User’s nickname.
mid Identifier of user who is logged in.
picture User’s profile image URL.
statusMessage User’s status message. Not included in the object if the user has not created a status message.

Methods

LineApiClient#getMyProfileWithResultBlock:

Example

[[mAdapter getLineApiClient] getMyProfileWithResultBlock:^(NSDictionary *aResult, NSError *aError)
{
    if (aResult)
    {
        NSString *displayName = aResult[@"displayName"];
        NSString *mid = aResult[@"id"];
        NSString *pictureUrl = aResult[@"pictureUrl"];
        NSString *statusMessage = aResult[@"statusMessage"];
        // do something...
    }
    else
    {
        NSLog(@"%@", aError);
        // do something for error...
    }
}];

Profile image thumbnails

You can retrieve the URL of a user’s profile image via certain APIs. You can resize the image by adding a suffix. The LINE platform supports the following image sizes and suffixes:

Image size Suffix
200 x 200 /large
51 x 51 /small

You can retrieve the large image with the following URL:

http://dl.profile.line.naver.jp/abcdefghijklmn/large