# Setting up your project

This topic explains how to integrate the LINE SDK for iOS Objective-C into your iOS project and apply necessary configurations.

# Prerequisites

To build and use the LINE SDK for iOS Objective-C, you need:

  • A provider and a LINE Login channel. You can create both in the LINE Developers Console.
  • iOS 10.0 or later as the deployment target

# Downloading the SDK

You can download the LINE SDK for iOS Objective-C using Cocoapods (opens new window) or from the "Downloads" page.

# Download with Cocoapods

If you are not familiar with CocoaPods, see CocoaPods Getting Started Guide (opens new window). You will need the CocoaPods gem installed on your machine before integrating the LINE SDK for iOS Objective-C into your app through CocoaPods.

  1. Once your Podfile is prepared, add the pod command below to your Podfile. If you are using Swift, make sure use_frameworks! is specified in your Podfile.

    pod 'LineSDK', '~> 5.0'
    
  2. Run the following command:

    $ pod install
    

The LINE SDK for iOS Objective-C will be downloaded and integrated into your Xcode workspace.

# Download from the "Downloads" page

Download the LINE SDK for iOS Objective-C from the Downloads page. Click the link of the SDK file and save to any directory.

Note

We recommend using the latest version of the SDK as the previous versions of the SDK have been deprecated.

Now you can add the SDK files to your Xcode project by following the steps described in the following sections.

Add the following frameworks to the "Link Binary With Libraries" section on your application target’s "Build Phases" settings tab.

  • LineSDK.framework
  • CoreTelephony.framework
  • Security.framework

Add the LineSDKResource.bundle file to the "Copy Bundle Resources" section on your application target’s "Build Phases" settings tab.

# Setting required build settings

Add -ObjC to the "Other Linker Flags" section on "Build Settings" settings tab.

# Enabling keychain sharing

The LINE SDK for iOS Objective-C uses the Keychain feature to store the user’s authentication credentials. As a result, your application must enable Keychain Sharing to use the SDK.

  1. Enable Keychain Sharing from Capabilities > Keychain Sharing in your Xcode Project settings.
  2. Add the Keychain Sharing entitlement to your entitlements file.
  3. Add the Keychain Sharing feature to your App ID.
Note

Your App ID is found in your Apple developer account.

# Linking your app to your channel

# In the LINE Developers Console

Linking your app to a LINE Login channel requires some configuration. In the LINE Developers Console, go to your LINE Login channel settings and complete these fields on the LINE Login tab:

  • iOS bundle ID: Bundle identifier of your app found in the "General" tab in your Xcode project settings. Must be lowercase. For example, com.example.app. You can specify multiple bundle identifiers by entering each one on a new line.
  • iOS universal link: Set to the universal link configured for your app. For more information on how to handle the login process using a universal link, see Using universal links.

LINE Login iOS bundle ID and universal link settings.

# In the Info.plist file

  1. In Xcode, right-click your app’s Info.plist file and select "Open As" > "Source Code". Insert the following snippet just before the last </dict> tag.

    <key>LineSDKConfig</key>
    <dict>
        <key>ChannelID</key>
        <string>1234567890</string>
    </dict>
    
  2. Change "1234567890" to the correct channel ID for your channel. Your channel ID is found in the Basic information section of the LINE Developers Console.

# Setting up app-to-app login

To let users automatically log in to your app if they are logged in to LINE, and handle the login result returned from LINE, edit your Info.plist file and AppDelegate.m file.

# Configuring the Info.plist file

Add the required settings for app-to-app login to the Info.plist file.

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <!-- Specify URL scheme to use when returning from LINE to your app. -->
            <string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        </array>
    </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <!-- Specify URL scheme to use when launching LINE from your app. -->
    <string>lineauth2</string>
</array>

This snippet adds the following settings:

Key Description
CFBundleURLSchemes Use line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER) to define the URL scheme needed to open your app. iOS stores this URL scheme for later reference. LINE Login uses this scheme to open your app after the LINE Platform returns a login result.
Note: The URL scheme lineauth2 is already used to activate LINE. Do not use this scheme in CFBundleURLSchemes.
LSApplicationQueriesSchemes Specify lineauth2 to allow launching of LINE from your app. The app will launch LINE as part of the login process.

# Configuring the AppDelegate.m file

Add the following code to the AppDelegate.m file.

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options
{
    return [[LineSDKLogin sharedInstance] handleOpenURL:url];
}