버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

...

App Event Method Initialization (iOS Only)

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_ios_appDelegate
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

	var window: UIWindow?
	
	override init() {
		KGTApplication.setSwizzleAppDelegate(delegate: AppDelegate.description())
	}

}

SDK Initialization

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_init_sdk
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube

/**
 * When using a single app
 */
let config = KGTConfig(appId: "909428",
                       appSecret: "c3c38bbfa3828b342d946e9770c974d0",
                       appVersion: "1.0.0",
                       market: "appStore",
                       ageRating: "14",
                       serverType: .QA,
                       logLevel: .Verbose)

/**
 * When using an app group
 */
let apps: [String : String] = [ "909428" : "c3c38bbfa3828b342d946e9770c974d0",
                                "921478" : "5891c32124ca35821890a0bc1cec77a5"]
let config = KGTConfig(appGroupId: "tubeAppGroup",
                       apps: apps,
                       appVersion: "1.0.0",
                       market: "appStore",
                       ageRating: "14",
                       serverType: .QA,
                       logLevel: .Verbose)

KGTApplication.initSDK(config)

Start

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_start
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube

KGTApplication.start { error in
	if error.isSuccess {
		// WhenIf the start is successful
				
		// Check Whetherif auto-login is enabled
		let isLoggedIn = KGTPlayer.isLoggedIn
				
		if isLoggedIn {
			// The current Player's ID issued by the platform
			let playerId = KGTPlayer.currentPlayer?.playerId
					
			// Platform access token
			let accessToken = KGTPlayer.accessToken
					
			// Retrieve the current IDP authentication information
			let idpProfile = KGTPlayer.currentPlayer?.idpProfile
					
			// [TODO] Move to the game screen.
		} else {
			// [TODO] If auto-login is not enabled, move to the login screen.
		}
				
	} else {
		// If the start fails - since initialization failed, retry the start or close the app.
				
		if error.code == KGTErrorCode.networkFailure ||
			error.code == KGTErrorCode.serverTimeout ||
			error.code == KGTErrorCode.serverConnectionFalied {
			// [TODO] If a network error occurs, notify the user ofthat the start failurefailed due to a network issue and retry.
		} else {
			// [TODO] If other errors occur, provide an error guidancenotification and request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
		}
	}
}

Pause

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_pause
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube
 
KGTApplication.pause()

Resume

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_resume
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube
 
KGTApplication.resume { error in
	if error.isSuccess {
		// [TODO] If resume is successful, resume the game screen.
	} else {
		// [TODO] If resume fails, movenavigate to the login screen if it’s an authentication failure; failsotherwise, or show an error popup and check whetherif tothe retryuser forwants otherto errorsretry.
		if error.code == KGTErrorCode.authFailure ||
			error.code == KGTErrorCode.idpAuthFailure {
			// [TODO] IfIn case of authentication failsfailure, move to the start screen and perform the new login flow again.
		} else {
			// [TODO] ForIf other errors occur, provide an error guidancenotification and retry the resume. - If the issue persists, considerclose closing the app.
		}
	}
})

Login

...

발췌문 삽입
EN_Login SDK ExampleEN_
Login SDK Example
namelogin
nopaneltrue

Logging In Without Using the Default Login UI

발췌문 삽입
EN_Login SDK ExampleEN_
Login SDK Example
namelogin_custom
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube

// Set the IdpCode for login
let idpCode = KGTIdpCode.Kakao

// Login with a specific IDP
KGTPlayer.login(with: idpCode) { error in
	if error.isSuccess {
		// IDP login and platform login successful

        // The current Player's ID issued by the platform
		let playerId = KGTPlayer.currentPlayer?.playerId
					
		// Platform access token
		let accessToken = KGTPlayer.accessToken
					
		// Retrieve the current IDP authentication information
		let idpProfile = KGTPlayer.currentPlayer?.idpProfile

		// [TODO] Since login was successful, proceed to the game screen.
	} else {
		// IDP login or platform login failed
		// [TODO] If login fails, inform the user and prompt them to retry.

        if error.code == KGTErrorCode.networkFailure ||
			error.code == KGTErrorCode.serverTimeout ||
			error.code == KGTErrorCode.serverConnectionFailed {
			// [TODO] If a networkother errors occur, provide an error occurs, request a login retrynotification and prompt the user to retry logging in.
		} else if error.code == KGTErrorCode.blockedByPolicy {
			// [TODO] Login attempt from a blocked country code or IP range. Handle this accordingly.
        } else if error.code == KGTErrorCode.userCanceled {    
			// [TODO] TheSince the user canceled during the login process, so the login screen should remainbe maintained.
		} else {
			// [TODO] ForIf other errors occur, informprovide an theerror usernotification and prompt requestthe auser loginto retry logging in. - CheckIt is necessary to check the error code and logs to identifydetermine the cause.
		}
	}
})

Logout

...

발췌문 삽입
EN_Logout SDK ExampleEN_
Logout SDK Example
namelogout
nopaneltrue

Logging Out Without Using the Default Logout UI

발췌문 삽입
EN_Logout SDK ExampleEN_
Logout SDK Example
namelogout_custom
nopaneltrue

...

코드 블럭
languagejava
import KakaoGameTube

// Unregister request
KGTPlayer.unregister(showUI: false) { error in 
    if error.isSuccess {
        // Unregistration successful

        // [TODO] Return to the start screen
    } else {
        // Unregistration failed 
    }
})

Account Linking

...

발췌문 삽입
EN_Account Linking SDK ExampleEN_
Account Linking SDK Example
nameconnect
nopaneltrue

Linking Accounts Without Using the Default Account Linking UI

발췌문 삽입
EN_Account Linking SDK ExampleEN_
Account Linking SDK Example
nameconnect_custom
nopaneltrue

...

Retrieve My Information

발췌문 삽입
EN_Profile SDK ExampleEN_
Profile SDK Example
nameplayer_currentPlayer
nopaneltrue

...

Retrieve My IDP Information

발췌문 삽입
EN_Profile SDK ExampleEN_
Profile SDK Example
nameplayer_idpProfile
nopaneltrue

...

Retrieve Language Code

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_language_code
nopaneltrue

...

Retrieve Country Code

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_country_code
nopaneltrue

...

Retrieve IP-based Country Code

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_geo_country_code
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube

let countryCode = KGTSystem.geoCountryCode

Retrieve Device ID

발췌문 삽입
EN_System Information SDK ExampleEN_System
System Information SDK Example
namesystem_device_id
nopaneltrue

...

Retrieve Device Model

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_device_model
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube

let deviceModel = KGTSystem.deviceModel

Retrieve OS Name

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_os_name
nopaneltrue

...

Retrieve Network Connection Status

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_is_network_connected
nopaneltrue

...

Retrieve Connected Network Type

발췌문 삽입
EN_System Information SDK ExampleEN_
System Information SDK Example
namesystem_network_type
nopaneltrue

...

Setting Up KakaoTalk Game Message Reception

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_show_setting
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube
import KakaoGameTubeKakao

// Display the view to set the KakaoTalk game message reception settings
KGTKakaoTalk.showSetting { error, isAllowedMe in
    if error.isSuccess {
        // Successfully set the KakaoTalk game message reception settings
        let isAllowedMe = isAllowedMe // Whether message reception is allowed as per the settings
    } else if error.code == KGTErrorCode.notKakaoTalkUser {
        // The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
    } else {
        // Failed to set the KakaoTalk game message reception settings
    }
})

Retrieve KakaoTalk Profile

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_talk_profile
nopaneltrue

코드 블럭
languageswift
import KakaoGameTubeKakaoGame
import KakaoGameTubeKakaoKakaoGameKakao

// Display the view to set theRetrieve KakaoTalk game message reception settings
profile
KGTKakaoTalk.showSettingtalkProfile { error, isAllowedMeprofile in
    	if error.isSuccess {
        		// Successfully setretrieved the KakaoTalk game message reception settings
        let isAllowedMeprofile
		let talkProfile = isAllowedMeprofile // Whether message reception is allowed The KakaoTalk profile information of the logged-in user
    } else if error.code == KGTErrorCode.notKakaoTalkUser {
        		// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
    	} else {
        		// Failed to setretrieve the KakaoTalk game message reception settings
    profile
	}
})

Retrieve KakaoTalk Game Friend List

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_friends
nopaneltrue

...

Sending KakaoTalk Game Messages

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_send_game_message
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube
import KakaoGameTubeKakao

// Friend object retrieved via the friends API
let kakaoProfile: KGTKakaoFriendProfile = // Kakao profile (KGTKakaoFriendProfile object)

// [TODO] Set the template IDId
let templateId = ""

// [TODO] Set the arguments for the message template
var argumentDic: [String: Any]? = [:]
argumentDic?["rog_link"] = "test=100&hello20111"
argumentDic?["bruce2"] = "test=100&hello=20111"

// Send KakaoTalk game message
KGTKakaoTalk.sendGameMessage(kakaoProfile: kakaoProfile, templateId: templateId, argumentDic: argumentDic) { error in
    if error.isSuccess {
        // Successfully sent KakaoTalk chat message
    } else {
        if error.code == KGTErrorCode.messageSettingDisabled {
            // The recipient has set message reception to blockbe messagesdisabled.
        } else if error.code == KGTErrorCode.exceedDailyUsage {
            // The/ Occurs when the daily quota for sending messages into a specific app (regardless of the recipient) has beenis exceeded.
        } else if error.code == KGTErrorCode.exceedMonthlyUsage {
            // Occurs when Thethe monthly quota for sending messages to a specific person infor a specific app has beenis exceeded.
        } else {
            // Failed to send KakaoTalk chat message
        }
    }
})

Sending KakaoTalk Friend Invitation Messages

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_send_invite_message
nopaneltrue

코드 블럭
languageswift
import KakaoGameTube
import KakaoGameTubeKakao

// [TODO] Set whether to display as a popup window
let isSingle = true

// [TODO] Set whether to display as a popup window
let isPopup = true

// [TODO] Set the template IDId
let templateId = ""

// [TODO] Set the arguments for the message template
var argumentDic: [String: Any]? = [:]
argumentDic?["rog_link"] = "test=100&hello20111"
argumentDic?["bruce2"] = "test=100&hello=20111"

KGTKakaoTalk.sendInviteMessage(isSingle: isSingle, isPopup: isPopup, templateId: templateId, argumentDic: argumentDic) { error, users in
    if error.isSuccess {
        // Successfully sent KakaoTalk invite message
        for user in users {
            // Check the list of users who received the invite message
        }
    } else {
        // Failed to send to all users (common cause needs to be returned)
        if error.code == KGTErrorCode.messageSettingDisabled {
            // The recipient has set message reception to blockbe messagesdisabled.
        } else if error.code == KGTErrorCode.exceedDailyUsage {
            // TheOccurs when the daily quota for sending messages into a specific app (regardless of the recipient) has beenis exceeded.
        } else if error.code == KGTErrorCode.exceedMonthlyUsage {
            // Occurs when Thethe monthly quota for sending messages to a specific person infor a specific app hasis been exceeded.
        } else {
            // Failed to send KakaoTalk invite message
        }
    }
})

Adding a KakaoTalk Channel

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_add_plus_friend
nopaneltrue

...