This document guides how to use the Kakao SDK for iOS("iOS SDK") provided by the Kakao API platform.
The modules and main features of iOS SDK are below.
Module | Client | Description |
---|---|---|
KakaoSDKCommon |
- | Common module for essential elements Including PrivacyInfo.xcprivacy fileMain features: Initialize |
KakaoSDKAuth |
AuthApi |
Module for the authentication and token management through Kakao Login Main features: Check token presence API |
KakaoSDKUser |
UserApi |
Module for the Kakao Login APIs Main features: Kakao Login API, Retrieve user information API |
KakaoSDKShare |
ShareApi |
Module for the Kakao Talk Sharing APIs Main features: Send message with custom template API |
KakaoSDKTalk |
TalkApi |
Module for the Kakao Talk Channel, Kakao Talk Social, Kakao Talk Message APIs¹⁾ Main features: Follow Kakao Talk Channel API |
KakaoSDKTemplate |
- | Module for message templates |
KakaoSDKFriend |
PickerApi |
Module for the picker APIs¹⁾ Main features: Retrieve friends through picker API |
KakaoSDKFriendCore |
- | Module for the operations of the picker |
KakaoSDKNavi |
NaviApi |
Module for the Kakao Navi APIs |
KakaoSDKCert |
CertApi |
Module for the Kakao Certification APIs¹⁾ |
KakaoSDKCertCore |
- | Module for the operations of the Kakao Certificate Including PrivacyInfo.xcprivacy file |
1) Use the KakaoSDKUser
module together for login-based APIs
Module | Client | Description |
---|---|---|
RxKakaoSDKCommon |
- | Common module for essential elements Main features: Initialize |
RxKakaoSDKAuth |
AuthApi |
Module for the authentication and token management through Kakao Login Main features: Check token presence API |
RxKakaoSDKUser |
UserApi |
Module for the Kakao Login APIs Main features: Kakao Login API, Retrieve user information API |
RxKakaoSDKShare |
ShareApi |
Module for the Kakao Talk Sharing APIs |
RxKakaoSDKTalk |
TalkApi |
Module for the Kakao Talk Channel, Kakao Talk Social, Kakao Talk Message APIs¹⁾ Main features: Follow Kakao Talk Channel |
RxKakaoSDKFriend |
PickerApi |
Module for the picker APIs¹⁾ Main features: Retrieve friends through picker |
1) Use the RxKakaoSDKUser
module together for login-based APIs
Some modules in the Kakao SDK are dependent on another module. If you add the Common or Auth module, its subordinate modules are automatically added together.
The minimum requirements for iOS SDK are below.
The iOS SDK uses the following libraries that are automatically installed when installing the iOS SDK.
Set iOS app information on [My Application] > [Platform]. Refer to Platform.
Since iOS 9.0, iOS only allows apps registered in Allowlist to enhance security. Register Allowlist to allow the app to run Kakao Talk.
Queried URL Schemes
key with an array type on [Info] > [Custom iOS Target Properties]kakaokompassauth
: Kakao Loginkakaolink
: Kakao Talk Sharingkakaoplus
: Kakao Talk ChannelOr add the keys manaully in the Info.plst file as follows.
<key>LSApplicationQueriesSchemes</key>
<array>
<!-- Login with Kakao Talk -->
<string>kakaokompassauth</string>
<!-- Kakao Talk Sharing -->
<string>kakaolink</string>
<!-- Kakao Talk Channel -->
<string>kakaoplus</string>
</array>
The Info.plist file internally uses LSApplicationQueriesSchemes
instead of Qualied URL Schemes
. In Xcode 14 and earlier, the menu settings may also appear as LSApplicationQueriesSchemes
instead of Quedied URL Schemes
.
Set the Native app key in kakao${YOUR_NATIVE_APP_KEY}
format on [Info] > [URL Type] > [URL Schemes]. For example, if your Native app key is 123456789, set 'URL Schemes' to "kakao123456789".
The URL Schemes are used to generate the Custom URL Scheme. The Custom URL Scheme is used to run the service app through a Kakao Talk message or to go back to the service app after Kakao Login. The Custom URL Schemes are in the following format.
kakao${NATIVE_APP_KEY}://oauth
kakao${NATIVE_APP_KEY}://kakaolink
To install the Kakao SDK, use Swift Package Manager (SPM).
Install using Cocoapods is no longer supported in iOS SDK 2.23.0 or higher version.
Select ➊ [Project Target] > ➋ [Package Dependencies] > ➌ [Packages] and click [+].
Search the repository URL below for the iOS SDK on ➍ [Search].
SDK | Repository Name | Repository URL |
---|---|---|
iOS SDK | kakao-ios-sdk |
https://github.com/kakao/kakao-ios-sdk |
ReactiveX iOS SDK | kakao-ios-sdk-rx |
https://github.com/kakao/kakao-ios-sdk-rx |
Check the name of the repository and select [Branch] for ➎ [Dependency Rule]. Input the branch name as master
and click ➏ [Add Packages].
Set [Dependency Rule] to install a specific version. But only versions higher than 2.8.5 are available.
On the screen presenting avaiable packages, check the desired modules on ➐ [Package Product] and click ➑ [Add Packages]. To install all of the modules, select [KakaoSDK] or [RxKakaoSDK].
The installed iOS SDK is presented on [Packages].
Each target of the project requires the iOS SDK separately. To install the iOS SDK for the test app, set the [Add to Target] to the test app.
When using SPM to install KakaoSDKFriend and RxKakaoSDKFriend modules, set the resource bundle for the picker. Add KakaoSDKFriendResources.bundle file to [Build Phase] > [Copy Bundle Resources] by clicking [+] or drag and drop.
To use iOS SDK in the app, import files of the required modules. Required modules for each product are below.
// iOS SDK
import KakaoSDKCommon
// ReactiveX iOS SDK
import KakaoSDKCommon
import RxKakaoSDKCommon
// iOS SDK
import KakaoSDKCommon
import KakaoSDKAuth
import KakaoSDKUser
// ReactiveX iOS SDK
import KakaoSDKCommon
import KakaoSDKAuth
import KakaoSDKUser
import RxKakaoSDKCommon
import RxKakaoSDKAuth
import RxKakaoSDKUser
// iOS SDK
import KakaoSDKShare
import KakaoSDKTemplate // to use default template
// ReactiveX iOS SDK
import KakaoSDKShare
import KakaoSDKTemplate // to use default template
import RxKakaoSDKShare
// iOS SDK
import KakaoSDKAuth
import KakaoSDKUser
import KakaoSDKTalk
import KakaoSDKFriend // to use picker
// ReactiveX iOS SDK
import KakaoSDKAuth
import KakaoSDKUser
import KakaoSDKTalk
import KakaoSDKFriend // to use picker
import RxKakaoSDKAuth
import RxKakaoSDKUser
import RxKakaoSDKTalk
import RxKakaoSDKFriend // to use picker
// iOS SDK
import KakaoSDKTalk
import KakaoSDKUser // to use Check Kakao Talk Channel Relationship API
// ReactiveX iOS SDK
import KakaoSDKTalk
import KakaoSDKUser // to use Check Kakao Talk Channel Relationship API
import RxKakaoSDKTalk
import RxKakaoSDKUser // to use Check Kakao Talk Channel Relationship API
import KakaoSDKNavi
Import the iOS SDK and initialize it with the Native app key. Add the codes below in AppDelegate.swift.
When using SwiftUI Life Cycle, add the codes in ${PROJECT_NAME}App instead of AppDelegate.swift.
import KakaoSDKCommon
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
KakaoSDK.initSDK(appKey: "${NATIVE_APP_KEY}")
...
}
import RxKakaoSDKCommon
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
RxKakaoSDK.initSDK(appKey: "${NATIVE_APP_KEY}")
...
}
import SwiftUI
import KakaoSDKCommon
import KakaoSDKAuth
...
@main
struct SwiftUI_testApp: App {
...
init() {
// Initialize Kakao SDK.
KakaoSDK.initSDK(appKey: "${NATIVE_APP_KEY}")
}
...
}
In iOS SDK 2.8.3, the class names, used for initialization, have been changed.
- KakaoSDKCommon → KakaoSDK
- RxKakaoSDKCommon → RxKakaoSDK