iOS SDK reference

Classes

LineSDKAPI

Class

Utility class for calling the Social API.

Superclass

NSObject

Declared in

LineSDKAPI.h

Methods

initWithConfiguration
- (instancetype)initWithConfiguration:(LineSDKConfiguration *)configuration NS_DESIGNATED_INITIALIZER;

Initializes LineSDKAPI using LineSDKConfiguration.

currentAccessToken
- (nullable LineSDKAccessToken *)currentAccessToken;

Gets the access token that the SDK is using for the user.

Return value

LineSDKAccessToken which contains the access token if available. nil if no access token is available.

getProfileWithCallbackQueue:completion
- (void)getProfileWithCallbackQueue:(dispatch_queue_t)queue completion:(LineSDKAPIGetProfileCompletion)completion NS_SWIFT_NAME(getProfile(queue:completion:));

Gets the user's profile information. To specify a dispatch queue where the completion block is to be executed, pass the desired queue into the queue parameter.

Parameters
Parameter Description
queue Queue where the completion block is executed. The completion block is executed in the main queue if this is nil.
completion Completion block called when the user's profile information is returned.
Completion block arguments
Argument Description
profile The user's profile information.
error Error returned by the API call. nil if successful.
getProfileWithCompletion
- (void)getProfileWithCompletion:(void(^)(LineSDKProfile * _Nullable profile, NSError * _Nullable error))completion NS_SWIFT_NAME(getProfile(completion:));

Gets the user's profile information. The completion block is executed in the main queue.

Parameters
Parameter Description
completion Completion block called when the user's profile information is returned.
Completion block arguments
Argument Description
profile The user's profile information.
error Error returned by the API call. nil if successful.
logoutWithCallbackQueue:completion
- (void)logoutWithCallbackQueue:(dispatch_queue_t)queue completion:(LineSDKAPILogoutCompletion)completion NS_SWIFT_NAME(logout(queue:completion:));

Revokes the access token. To specify a dispatch queue where the completion block is to be executed, pass the desired queue into the queue parameter.

Parameters
Parameter Description
queue Queue where the completion block is executed. The completion block is executed in the main queue if this is nil.
completion Completion block called when the logout is completed.
Completion block arguments
Argument Description
success YES if the logout succeeds. NO if the logout fails.
error Error returned by the API call. nil if successful.
logoutWithCompletion
- (void)logoutWithCompletion:(void(^)(BOOL success, NSError * _Nullable error))completion;

Revokes the access token. The completion block is executed in the main queue.

Parameters
Parameter Description
completion Completion block called when the logout is complete.
Completion block arguments
Argument Description
success YES if the logout succeeds. NO if the logout fails.
error Error returned by the API call. nil if successful.
refreshTokenWithCallbackQueue:completion
- (void)refreshTokenWithCallbackQueue:(dispatch_queue_t)queue completion:(LineSDKAPITokenRefreshCompletion)completion NS_SWIFT_NAME(refreshToken(queue:completion:));

Refreshes the access token that the SDK is using for the user. To specify a dispatch queue where the completion block is to be executed, pass the desired queue into the queue parameter.

Parameters
Parameter Description
queue Queue where the completion block is executed. The completion block is executed in the main queue if this is nil.
completion Completion block called when the user's access token is refreshed.
Completion block arguments
Argument Description
accessToken The refreshed access token.
error Error returned by the API call. nil if successful
refreshTokenWithCompletion
- (void)refreshTokenWithCompletion:(void(^)(LineSDKAccessToken * _Nullable accessToken, NSError * _Nullable error))completion;

Refreshes the access token that the SDK is using. The completion block is executed in the main queue.

Parameters
Parameter Description
completion Completion block called when the access token is refreshed.
Completion block arguments
Argument Description
accessToken The refreshed access token.
error Error returned by the API call. nil if successful
verifyTokenWithCallbackQueue:Completion
- (void)verifyTokenWithCallbackQueue:(dispatch_queue_t)queue completion:(LineSDKAPIVerifyTokenCompletion)completion NS_SWIFT_NAME(verifyToken(queue:completion));

Checks whether the access token that the SDK is using for the user is valid or not. To specify a dispatch queue where the completion block is to be executed, pass the desired queue into the queue parameter.

Parameters
Parameter Description
queue Queue where the completion block is executed. The completion block is executed in the main queue if this is nil.
completion Completion block called when the user's token is verified.
Completion block arguments
Argument Description
result The result of the verify call.
error Error returned by the API call. nil if successful
verifyTokenWithCompletion
- (void)verifyTokenWithCompletion:(void(^)(LineSDKVerifyResult * _Nullable result, NSError * _Nullable error))completion;

Checks whether the access token that the SDK is using for the user is valid or not. The completion block is executed in the main queue.

Parameters
Parameter Description
completion Completion block called when the access token is verified.
Completion block arguments
Argument Description
result The result of the verify call.
error Error returned by the API call. nil if successful

LineSDKAccessToken

Class

Represents the access token that is used to call the Social API.

Superclass

NSObject

Declared in

LineSDKAccessToken.h

Properties

accessToken
@property (nonatomic, copy, readonly) NSString *accessToken;

Access token

expiresIn
@property (nonatomic, readonly) NSTimeInterval expiresIn;

The amount of time in milliseconds until the access token expires.

Methods

estimatedExpiredDate
- (NSDate *)estimatedExpiredDate;

Returns the estimated time in UNIX time of when the access token expires. The expiration time that is returned by this method is not exact because it is calculated using time values that are cached on the client.

Return value

The estimated time in UNIX time of when the access token expires.

LineSDKCredential

Class

Represents credentials that are used to grant access to the Social API.

Superclass

NSObject

Declared in

LineSDKAPI.h

Properties

accessToken
@property (nonatomic, strong, readonly, nullable) LineSDKAccessToken *accessToken;

Access token

permissions
@property (nonatomic, strong, readonly) NSOrderedSet<NSString *> *permissions;

The set of permissions that the access token holds. The following is a list of the permission codes.

Permission code Description
P The token can be used to get the user’s profile information.

LineSDKLogin

Class

Provides methods that are used to perform LINE login.

Superclass

NSObject

Declared in

LineSDKLogin.h

Protocols

LineSDKLoginDelegate

Properties

configuration
@property (nonatomic, strong, readonly) LineSDKConfiguration *configuration;

Contains various LINE SDK configuration values such as the Channel ID and the access token.

Methods

canLoginWithLineApp
- (BOOL)canLoginWithLineApp;

Checks to see if it is possible to log in using the LINE app.

Return value

YES if it is possible to log in using the LINE app and NO if it is not possible. If NO is returned, this means that the LINE app is not installed on the device.

handleOpenURL
- (BOOL)handleOpenURL:(NSURL *)aURL;

Handles the return data from the LINE app during app-to-app authentication. You must call the handleOpenUrl method in your application's openURL method as in the following example.

openURL example
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [[LineSDKLogin sharedInstance] handleOpenURL:url];
}
Parameters
Parameter Description
aURL The URL passed into the openURL call.
Return value

YES if the URL is successfully handled by the SDK. NO if it fails.

installLineApp
- (void)installLineApp;

Transitions to the app store to install the LINE app.

isAuthorized
- (BOOL)isAuthorized;

Checks to see if the user is logged in and has a access token.

Return value

YES if the SDK has a access token for the user. This signifies that the user is logged in. NO if there is no access token stored in the SDK.

isAuthorizing
- (BOOL)isAuthorizing;

Checks if login is in progress.

Return value

YES if login is in progress. Otherwise NO.

sharedInstance
+ (instancetype)sharedInstance;

Returns the singleton instance of LineSDKLogin.

startLogin
- (void)startLogin;

Begins the login process. If the LINE app is installed, the SDK defaults to using app-to-app authentication. If it is not installed, the SDK logs in using a browser.

startWebLoginWithSafariViewController
- (void)startWebLoginWithSafariViewController:(BOOL)useSafariViewControllerIfAvailable;

Begins the login process. This function uses a browser or Safari View Controller to log in, not app-to-app authentication.

Parameters
Parameter Description
useSafariViewControllerIfAvailable If YES, Safari View Controller is used to perform the login. If NO, a browser is used to perform the login.

LineSDKConfiguration

Class

Contains the settings that are needed to initialize the SDK.

Superclass

NSObject

Declared in

LineSDKConfiguration.h

Properties

channelID
@property (nonatomic, strong, readonly) NSString *channelID;

The Channel ID that the application is configured to use. This value is read from the LineSDKConfig section in the application's Info.plist.

Methods

currentAccessToken
- (nullable LineSDKAccessToken *)currentAccessToken;

Returns the access token that is stored by the SDK.

LineSDKProfile

Class

Represents a user's LINE profile in the Social API.

Superclass

NSObject

Declared in

LineSDKProfile.h

Properties

displayName
@property (nonatomic, copy, readonly) NSString *displayName;

The user’s display name.

pictureURL
@property (nonatomic, copy, readonly, nullable) NSURL *pictureURL;

The user’s profile media URL.

statusMessage
@property (nonatomic, copy, readonly, nullable) NSString *statusMessage;

The user’s status message.

userId
@property (nonatomic, copy, readonly) NSString *userID;

The user's user ID.

LineSDKVerifyResult

Class

Describes the result of an attempt to verify the access token.

Superclass

NSObject

Declared in

LineSDKVerifyResult.h

Properties

channelID

@property (nonatomic, copy, readonly) NSString *channelID;

The Channel ID that is used by the application.

expiresIn

@property (nonatomic, readonly) NSTimeInterval expiresIn;

The amount of time in milliseconds until the user access token expires.

permissions

@property (nonatomic, copy, readonly, nullable) NSOrderedSet<NSString *> *permissions;

The set of permissions that the user access token holds. The following is a list of the permission codes.

Permission code Description
P The token can be used to get the user’s profile information.

Protocols

LineSDKLoginDelegate

Protocol

Defines the methods used to receive event notifications from LineSDKLogin objects.

Extends protocol

NSObject

Declared in

LineSDKLogin.h

Methods

didLogin
- (void)didLogin:(LineSDKLogin *)login
credential:(nullable LineSDKCredential *)credential
profile:(nullable LineSDKProfile *)profile
error:(nullable NSError *)error;
Parameters
Parameter Description
login The LineSDKLogin object that is used to make the login request.
credential The credentials granted by the login request.
profile The profile information of the user.
error Information about the failure if the login request fails. nil if the login request is successful.