KakaoSDK

final public class KakaoSDK

카카오 SDK 공통의 환경변수 설정을 위한 클래스입니다.

싱글톤으로 제공되는 인스턴스를 사용해야 하며 다음과 같이 초기화할 수 있습니다.

// AppDelegate.swift
func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    KakaoSDK.initSDK(appKey: "<#Your App Key#>")

    return true
}

Important

SDK 초기화가 수행되지 않으면 SDK 내 모든 기능을 사용할 수 없습니다. 반드시 가장 먼저 실행되어야 합니다.
  • 카카오 SDK의 싱글톤 객체입니다. SDK를 사용할 때 반드시 이 객체가 가장 먼저 초기화되어야 합니다.

    Declaration

    Swift

    public static let shared: KakaoSDK
  • SDK 초기화를 수행합니다.

    Declaration

    Swift

    public static func initSDK(appKey: String,
                               customScheme: String? = nil,
                               loggingEnable: Bool = false,
                               hosts: Hosts? = nil,
                               approvalType: ApprovalType? = nil,
                               sdkIdentifier: SdkIdentifier? = nil)

    Parameters

    appKey

    카카오 디벨로퍼스에서 발급 받은 NATIVE_APP_KEY

    loggingEnable

    SDK에서 디버그 로깅를 사용 여부

  • 현재 SDK의 버전을 조회합니다.

    Declaration

    Swift

    public func sdkVersion() -> String
  • 초기화 시 지정한 loggingEnable

    Seealso

    SdkLog

    Declaration

    Swift

    public func isLoggingEnable() -> Bool
  • 설정된 앱키를 가져옵니다.

    Throws

    SdkError.ClientFailureReason.MustInitAppKey: SDK가 초기화되지 않았습니다. 앱키를 가져오기 전에 initSDK를 이용하여 먼저 싱글톤 인스턴스를 초기화해야 합니다.

    Declaration

    Swift

    public func appKey() throws -> String
  • KA Header를 가져옵니다.

    Declaration

    Swift

    public func kaHeader() -> String
  • redirectUri를 가져옵니다.

    Declaration

    Swift

    public func redirectUri() -> String