KakaoSDKCommon

final public class KakaoSDKCommon

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

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

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

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

    return true
}

Important

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

    Declaration

    Swift

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

    Declaration

    Swift

    public static func initSDK(appKey: String, customRedirectUri: String? = nil, loggingEnable: Bool = false, hosts: Hosts? = nil)

    Parameters

    appKey

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

    customRedirectUri

    로그인 시 인증코드를 발급 받을 URI. 내 앱의 커스텀 스킴에 로그인 요청임을 구분할 수 있는 host 및 path를 덧붙여 사용합니다. ex) myappscheme://oauth

    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