TCGBGamebase Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | TCGBGamebase.h |
Initialization
+ initializeWithConfiguration:completion:
This method initialize TCGBGamebase with TCGBConfiguration instance. InitializeCompletion return launching datas when TCGBGamebase has initialized and has completed getting launching informations from server.
+ (void)initializeWithConfiguration:(TCGBConfiguration *)configuration completion:(nullable InitializeCompletion)completionParameters
configuration |
A parameter that were set appId, appVersion, zoneType and etc. |
|---|---|
completion |
A completion that is called after initializing TCGBGamebase completed. |
Discussion
You must call this method first, after the app has launched.
Usage Example
- (void)onButtonInitialize {
[TCGBGamebase setDebugMode:YES];
TCGBConfiguration* config = [TCGBConfiguration configurationWithAppID:@"your app(project) ID" appVersion:@"your app version"];
[TCGBGamebase initializeWithConfiguration:config completion:^(LaunchingInfo launchingData, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"TCGBGamebase initialization is succeeded");
// Check status of you app.
// If status of app is maintenance or terminated service or etc, you must blocking UI and you should make user cannot log in your service.
// You can use [TCGBLaunching launchingStatus] method to check status of your app.
} else {
NSLog(@"TCGBGamebase initialization is failed with error:[%@]", [error description]);
}
}];
}
Declared In
TCGBGamebase.h
+ initializeWithConfiguration:launchOptions:completion:
This method initialize TCGBGamebase with TCGBConfiguration instance. InitializeCompletion return launching datas when TCGBGamebase has initialized and has completed getting launching informations from server.
+ (void)initializeWithConfiguration:(TCGBConfiguration *)configuration launchOptions:(nullable NSDictionary<NSString*,id> *)launchOptions completion:(nullable InitializeCompletion)completionParameters
configuration |
A parameter that were set appId, appVersion, zoneType and etc. |
|---|---|
launchOptions |
An extra launch options when application needs to be customized initialization. |
completion |
A completion that is called after initializing TCGBGamebase completed. |
Discussion
You must call this method first, after the app has launched.
Declared In
TCGBGamebase.h
Environment Setting & Getting
+ setDebugMode:
Method that setting TCGBGamebase to debug mode. Debug mode can print logs that has debug, info and verbose log level on console app.
+ (void)setDebugMode:(BOOL)debugModeParameters
debugMode |
Boolean value that whether use debug mode or not. |
|---|
Discussion
You should call this method before calling initializeWithConfiguration:launchOptions:completion: method.
Usage Example
- (void)onButtonInitialize {
[TCGBGamebase setDebugMode:YES];
TCGBConfiguration* config = [TCGBConfiguration configurationWithAppID:@"your app(project) ID" appVersion:@"your app version"];
[TCGBGamebase initializeWithConfiguration:config completion:^(LaunchingInfo launchingData, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"TCGBGamebase initialization is succeeded");
// Check status of you app.
// If status of app is maintenance or terminated service or etc, you must blocking UI and you should make user cannot log in your service.
// You can use [TCGBLaunching launchingStatus] method to check status of your app.
} else {
NSLog(@"TCGBGamebase initialization is failed with error:[%@]", [error description]);
}
}];
}
See Also
Declared In
TCGBGamebase.h
+ isDebugMode
Method that got boolean value whether current SDK is running with debug mode or not.
+ (BOOL)isDebugModeReturn Value
Boolean value that current SDK is running with debug mode or not.
Discussion
Usage Example
-(void)onButtonIsDebugMode {
BOOL isDebugMode = [TCGBGamebase isDebugMode];
NSLog(@"Debug Mode is %@", isDebugMode ? @"on":@"off");
}
See Also
Declared In
TCGBGamebase.h
+ SDKVersion
Method that got SDK version of client
+ (NSString *)SDKVersionReturn Value
String value that got client sdk version.
Discussion
Usage Example
- (void)onButtonGetSDKVersion {
NSString* version = [TCGBGamebase SDKVersion];
NSLog(@"Client SDK Version = %@", version];
}
Declared In
TCGBGamebase.h
+ appID
Method that got ‘Projet ID (app ID)’ is set by initialize TCGBGamebase.
+ (nullable NSString *)appIDReturn Value
String value that got app id (project id).
Discussion
‘Project ID (app ID)’ is indicated on NHN Cloud Console Project List Page.
Usage Example
- (void)onButtonGeTCGBPID {
NSString* appID = [TCGBGamebase appID];
NSLog(@"App ID = %@", appID);
}
Declared In
TCGBGamebase.h
+ userID
Method that got an UserID that identify each user in Platform.
+ (nullable NSString *)userIDReturn Value
String value that got userID.
Discussion
You can get this after login has succeeded.
Usage Example
- (void)onButtonGetUserID {
NSString* userID = [TCGBGamebase userID];
NSLog(@"User ID = %@", userID];
}
Declared In
TCGBGamebase.h
+ accessToken
Method that got an access token is taken from TCGB Platform server.
+ (nullable NSString *)accessTokenReturn Value
String value that got TCGB Access Token.
Discussion
You can get htis after login has succeeded. This value will be removed by logout, withdrawal and will be expired 15 day after last logged in.
Usage Example
- (void)onButtonAccessToken {
NSString* TCGBAccessToken = [TCGBGamebase accessToken];
NSLog(@"User ID = %@", TCGBAccessToken];
}
Declared In
TCGBGamebase.h
+ isInitialized
Return whether Gamebase is initialized or not.
+ (BOOL)isInitializedReturn Value
Boolean value whether Gamebase is initialized.
Declared In
TCGBGamebase.h
+ isSandbox
Return whether this project is sandbox mode or not.
+ (BOOL)isSandboxReturn Value
Boolean value whether this project is sandbox mode.
Declared In
TCGBGamebase.h
+ isSuccessWithError:
Method that distinguished the error object is whether succeeded or failed.
+ (BOOL)isSuccessWithError:(nullable TCGBError *)errorParameters
error |
Object for TCGBError class what distinguished is whether succeeded or not. |
|---|
Return Value
Boolean value that the TCGBError object is whether succeeded of failed.
Discussion
Usage Example
- (void)onButtonSuccessOfFail {
[TCGBGamebase logoutWithCompletion:^(TCGBError *error) {
BOOL isSuccess = [TCGBGamebase isSuccessWithError:error];
if (isSuccess) {
NSLog(@"logout is Success");
} else {
NSLog(@"logout is Fail");
}
}
}
Declared In
TCGBGamebase.h
System Language & Country
+ deviceLanguageCode
Get Language Code from device settings.
+ (NSString *)deviceLanguageCodeReturn Value
language code from settings.
Availability
Added 1.14.0.
Declared In
TCGBGamebase.h
+ countryCodeOfDevice
Get country code from device locale.
+ (NSString *)countryCodeOfDeviceDeclared In
TCGBGamebase.h
Display Language
+ setDisplayLanguageCode:
Set Display Language Code when initializing Gamebase SDK.
+ (void)setDisplayLanguageCode:(NSString *)languageCodeParameters
languageCode |
It represent language code (ISO-639) |
|---|
Declared In
TCGBGamebase.h
+ displayLanguageCode
Method that returns displayLanguage that you have set.
+ (nullable NSString *)displayLanguageCodeReturn Value
String value of language code (ISO-639)
Declared In
TCGBGamebase.h
Login API
+ loginWithType:viewController:completion:
Try to login with type of ID Provider. If after succeeded, completion returns TCGB Auth informations include authToken, userID.
+ (void)loginWithType:(NSString *)type viewController:(UIViewController *)viewController completion:(LoginCompletion)completionParameters
type |
String value of IDPType name (guest, facebook, iosgamecenter). |
|---|---|
viewController |
UIViewController object that present login view controller. |
completion |
callback that returned whether login success or fail and return TCGBAuthToken. |
Discussion
TCGBGamebase has loginForLastLoggedInProviderWithCompletion method known as Auto-Login. So before you try to login, you should try to login with loginForLastLoggedInProviderWithCompletion: method. If it is failed, you can try to login with loginWithType:viewController:completion: method
Usage Example
- (void)onButtonLogin {
NSString* idpType = @"facebook";
UIViewController* topViewController = nil;
[TCGBGamebase loginForLastLoggedInProviderWithCompletion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"Login is succeeded.");
} else {
if (error.code == TCGB_ERROR_SOCKET_ERROR || error.code == TCGB_ERROR_RESPONSE_TIMEOUT) {
NSLog(@"Retry loginForLastLoggedInProviderWithCompletion: or Notify to user -\n\terror[%@]", [error description]);
} else {
NSLog(@"Try to login with loginWithType:viewController:completion:");
[TCGBGamebase loginWithType:idpType viewController:topViewController completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"Login is succeeded.");
} else {
NSLog(@"Login is failed.");
}
}];
}
}
}];
}
Declared In
TCGBGamebase.h
+ loginWithCredential:viewController:completion:
Try to login with credential information received from External SDK or OAuth.
+ (void)loginWithCredential:(NSDictionary<NSString*,id> *)credentialInfo viewController:(UIViewController *)viewcontroller completion:(LoginCompletion)completionParameters
credentialInfo |
NSDictionary value that contains provider_name (guest, facebook, iosgamecenter), access_token of IDP, access_token_secret of IDP that receive from IDP SDK. |
|---|---|
viewcontroller |
UIViewController object that present login view controller. |
completion |
callback that returned whether login is success or fail and return TCGBAuthToken. |
Discussion
Usage Example
- (void)onButtonLogin {
UIViewController* topViewController = nil;
NSString* facebookAccessToken = @"feijla;feij;fdklvda;hfihsdfeuipivaipef/131fcusp";
NSMutableDictionary* credentialInfo = [NSMutableDictionary dictionary];
credentialInfo[@"provider_name"] = @"facebook";
credentialInfo[@"access_token"] = facebookAccessToken;
[TCGBGamebase loginWithCredential:credentialInfo viewController:topViewController completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"Login is succeeded.");
} else {
if (error.code == TCGB_ERROR_SOCKET_ERROR || error.code == TCGB_ERROR_RESPONSE_TIMEOUT) {
NSLog(@"Retry loginForLastLoggedInProviderWithCompletion: or Notify to user -\n\terror[%@]", [error description]);
} else {
NSLog(@"Try to login with loginWithType:viewController:completion:");
[TCGBGamebase loginWithType:idpType viewController:topViewController completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"Login is succeeded.");
} else {
NSLog(@"Login is failed.");
}
}];
}
}
}];
Declared In
TCGBGamebase.h
+ loginForLastLoggedInProviderWithViewController:completion:
Try to login for last logged in ID Provider. This method use local stored name of last logged in IDP.
+ (void)loginForLastLoggedInProviderWithViewController:(UIViewController *)viewController completion:(LoginCompletion)completionParameters
completion |
callback that return whether login success or fail and return TCGBAuthToken |
|---|
Discussion
This method try to login with local stored TCGBAuthToken.
Usage Example
- (void)onButtonLogin {
NSString* idpType = @"facebook";
UIViewController* topViewController;
[TCGBGamebase loginForLastLoggedInProviderWithViewController:topViewController completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"Login is succeeded.");
} else {
if (error.code == TCGB_ERROR_SOCKET_ERROR || error.code == TCGB_ERROR_RESPONSE_TIMEOUT) {
NSLog(@"Retry loginForLastLoggedInProviderWithCompletion: or Notify to user -\n\terror[%@]", [error description]);
} else {
NSLog(@"Try to login with loginWithType:viewController:completion:");
[TCGBGamebase loginWithType:idpType viewController:topViewController completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"Login is succeeded.");
} else {
NSLog(@"Login is failed.");
}
}];
}
}
}];
}
Declared In
TCGBGamebase.h
Mapping API
+ addMappingWithType:viewController:completion:
If you have logged in with an IDP Type. You can map with the other ID Providers, excluding Logged in IDP type.
+ (void)addMappingWithType:(NSString *)type viewController:(UIViewController *)viewController completion:(LoginCompletion)completionParameters
type |
String value of IDPType name (guest, facebook, iosgamecenter). |
|---|---|
viewController |
UIViewController object that present login view controller. |
completion |
callback that return whether addMapping is success or fail and return TCGBAuthToken. If you received TCGB_ERROR_AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER or TCGB_ERROR_AUTH_ADD_MAPPING_ALREADY_HAS_SAME_IDP error, A TCGBAuthToken received from completion is not for current userID, but for already mapped account. |
Discussion
Mapping IDPs are just mapped to TCGB UserID. ID Provider type what mapped to UserID only can be removed from mapped UserID.
Warning: Warning: Logged in ID Provider type cannot be removed from UserID.
Warning: Warning: You can call addMapping after logged in.
Usage Example
- (void)onButtonAddMapping {
NSString* idpType = @"facebook";
[TCGBGamebase addMappingWithType:idpType viewController:nil completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"addMapping is succeeded.");
} else {
NSLog(@"addMapping is failed with Error:[%@]", [error description]);
if (error.code == TCGB_ERROR_AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER || error.code == TCGB_ERROR_AUTH_ADD_MAPPING_ALREADY_HAS_SAME_IDP) {
NSLog(@"This ID Provider type has mapped to the other UserID");
} else {
NSLog(@"addMapping is failed with error:[%@]", [error description]);
}
}
}];
}
Declared In
TCGBGamebase.h
+ addMappingWithCredential:viewController:completion:
Try to addMapping with credential information received from External SDK or OAuth.
+ (void)addMappingWithCredential:(NSDictionary<NSString*,id> *)credentialInfo viewController:(UIViewController *)viewcontroller completion:(LoginCompletion)completionParameters
credentialInfo |
NSDictionary value that contains provider_name (guest, facebook, iosgamecenter), access_token of IDP, access_token_secret of IDP that receive from IDP SDK. |
|---|---|
viewcontroller |
UIViewController object that present login view controller. |
completion |
callback that returned whether addMapping is success or fail and return TCGBAuthToken. |
Discussion
Usage Example
- (void)onButtonAddMapping {
UIViewController* topViewController = nil;
NSString* facebookAccessToken = @"feijla;feij;fdklvda;hfihsdfeuipivaipef/131fcusp"; // Get access token of your provider using provider SDK.
NSMutableDictionary* credentialInfo = [NSMutableDictionary dictionary];
credentialInfo[kTCGBAuthLoginWithCredentialProviderNameKeyname] = @"facebook";
credentialInfo[kTCGBAuthLoginWithCredentialAccessTokenKeyname] = facebookAccessToken;
[TCGBGamebase addMappingWithCredential:credentialInfo viewController:topViewController completion:^(TCGBAuthToken *authToken, TCGBError *error) {
if ([TCGBGamebase isSuccessWithError:error] == YES) {
NSLog(@"AddMapping is succeeded.");
} else if (error.code == TCGB_ERROR_SOCKET_ERROR || error.code == TCGB_ERROR_RESPONSE_TIMEOUT) {
NSLog(@"Retry addMapping")
} else if (error.code == TCGB_ERROR_AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
NSLog(@"Already mepped to other member");
} else {
NSLog(@"AddMapping Error - %@", [error description]);
}
}];
}
Declared In
TCGBGamebase.h
+ removeMappingWithType:viewController:completion:
Disconnect ID Provider from UserID.
+ (void)removeMappingWithType:(NSString *)type viewController:(nullable UIViewController *)viewController completion:(nullable RemoveMappingCompletion)completionParameters
type |
String value of IDPType name (guest, facebook, iosgamecenter). |
|---|---|
completion |
callback that return whether removeMapping is success or fail. |
Discussion
Warning: Warning: You cannot remove mapping last logged in ID Provider.
Usage Example
- (void)onButtonRemoveMapping {
NSString* idpType = @"facebook";
[TCGBGamebase removeMappingWithType:idpType viewController:topViewController completion:^(TCGBError *error) {
NSLog(@"removeMappingWityType:%@ is %@", idpType, [TCGBGamebase isSuccessWithError:error] == YES ? @"success":@"fail");
}];
}
Declared In
TCGBGamebase.h
Logout API
+ logoutWithViewController:completion:
This method make user logout from TCGB Game Platform.
+ (void)logoutWithViewController:(nullable UIViewController *)viewController completion:(nullable LogoutCompletion)completionParameters
completion |
callback that return whether logout is success or fail |
|---|
Discussion
This method try to logout from ID Provider SDK.
Usage Example
- (void)onButtonWithdrawal {
[TCGBGamebase logoutWithViewController:topViewController completion:^(TCGBError *error) {
NSLog(@"You have withdrew from TCGBGamebase : %@, [error debugDescription]);
}];
}
Declared In
TCGBGamebase.h
Withdrawal API
+ withdrawWithViewController:completion:
This method make user withdraw from TCGB Game Platform, but IdPs need to be unlink in each IdP user preference page.
+ (void)withdrawWithViewController:(nullable UIViewController *)viewController completion:(nullable WithdrawCompletion)completionParameters
completion |
callback that return whether withdrawal is success or fail |
|---|
Discussion
This method cannot drop out of IdP.
Usage Example
- (void)onButtonWithdrawal {
[TCGBGamebase withdrawWithViewController:topViewController completion:^(TCGBError *error) {
NSLog(@"You have withdrew from TCGBGamebase : %@, [error debugDescription]);
}];
}
Declared In
TCGBGamebase.h
TemporaryWithdrawal
+ requestTemporaryWithdrawalWithViewController:completion:
This method make user withdraw from TCGB Game Platform temporarily, but IdPs need to be unlink in each IdP user preference page.
+ (void)requestTemporaryWithdrawalWithViewController:(nullable UIViewController *)viewController completion:(nullable TemporaryWithdrawCompletion)completionParameters
viewController |
UIViewController object that present view controller. |
|---|---|
completion |
callback that returned whether temporary withdraw is success or fail and return TCGBTemporaryWithdrawalInfo. |
Declared In
TCGBGamebase.h
+ cancelTemporaryWithdrawalWithViewController:completion:
This method make user withdraw cancel from TCGB Game Platform temporarily.
+ (void)cancelTemporaryWithdrawalWithViewController:(nullable UIViewController *)viewController completion:(nullable WithdrawCompletion)completionParameters
viewController |
UIViewController object that present view controller. |
|---|---|
completion |
callback that returned whether cancel temporary withdraw is success or fail. |
Declared In
TCGBGamebase.h
+ withdrawImmediatelyWithViewController:completion:
This method make user withdraw from TCGB Game Platform immediately, but IdPs need to be unlink in each IdP user preference page.
+ (void)withdrawImmediatelyWithViewController:(nullable UIViewController *)viewController completion:(nullable WithdrawCompletion)completionParameters
viewController |
UIViewController object that present view controller. |
|---|---|
completion |
callback that returned whether immediately withdraw is success or fail. |
Declared In
TCGBGamebase.h
Login Information
+ lastLoggedInProvider
Method that return which IDP have been logged in at last time.
+ (nullable NSString *)lastLoggedInProviderReturn Value
An String that has name of IDPs.
Discussion
Usage Example
- (void)onButtonGettingLastLoggedinProvider {
NSString* lastProvider = [TCGBGamebase lastLoggedInProvider];
NSLog(@"lastLoggedInProvider returns %@", lastProvider];
}
Declared In
TCGBGamebase.h
+ requestLastLoggedInProviderWithCompletion:
Method that asynchronously return which IDP have been logged in at last time.
+ (void)requestLastLoggedInProviderWithCompletion:(void ( ^ ) ( NSString *_Nullable lastLoggedInProvider , TCGBError *_Nullable error ))completionDeclared In
TCGBGamebase.h
+ currentProvider
Method that return current IDP
+ (nullable NSString *)currentProviderReturn Value
An String that has name of IDPs.
Discussion
Usage Example
- (void)onButtonGettingCurrentProvider {
NSString* currentProvider = [TCGBGamebase currentProvider];
NSLog(@"currentProvider returns %@", currentProvider];
}
Declared In
TCGBGamebase.h
+ authMappingList
Method that returns which IDPs have been mapped to current UserID.
+ (nullable NSArray<NSString*> *)authMappingListReturn Value
An Array that has name of IDPs.
Discussion
Usage Example
- (void)onButtonGettingMappedAuthList {
NSArray* authList = [TCGBGamebase authMappingList];
NSLog(@"authMappingList returns %@", [authList description]);
}
Declared In
TCGBGamebase.h
ID Provider Information
+ authProviderUserIDWithIDPCode:
Method that return UserID of ID Provider such as ‘facebook’, ‘iosgamecenter’ and etc.
+ (nullable NSString *)authProviderUserIDWithIDPCode:(NSString *)IDPCodeParameters
IDPCode |
IDPCode string value that you want to get. |
|---|
Return Value
A String value of user ID.
Discussion
Usage Example
- (void)onButtonGettingIDPUserName {
NSString* userID = [TCGBGamebase authProviderUserIDWithIDPCode:@"facebook"];
NSLog(@"authProvider UserID = %@", userID);
}
Declared In
TCGBGamebase.h
+ authProviderAccessTokenWithIDPCode:
Method that return AccessToken of ID Provider such as ‘facebook’, ‘iosgamecenter’ and etc.
+ (nullable NSString *)authProviderAccessTokenWithIDPCode:(NSString *)IDPCodeParameters
IDPCode |
IDPCode string value that you want to get. |
|---|
Return Value
A String value of AccessToken.
Discussion
Usage Example
- (void)onButtonGettingIDPAccessToken {
NSString* accessToken = [TCGBGamebase authProviderAccessTokenWithIDPCode:@"facebook"];
NSLog(@"authProvider AccessToken = %@", accessToken);
}
Declared In
TCGBGamebase.h
+ authProviderProfileWithIDPCode:
Method that return Profile Information of ID Provider such as ‘facebook’, ‘iosgamecenter’ and etc.
+ (nullable TCGBAuthProviderProfile *)authProviderProfileWithIDPCode:(NSString *)IDPCodeParameters
IDPCode |
IDPCode string value that you want to get. |
|---|
Return Value
A String value of profile.
Discussion
Usage Example
- (void)onButtonGettingIDPProfile { NSString* profile = [TCGBGamebase authProviderProfileWithIDPCode:@“facebook”]; NSLog(@“authProvider profile = %@”, profile); }
Declared In
TCGBGamebase.h
+ banInfo
Method that return ban information of login response.
+ (nullable TCGBBanInfo *)banInfoReturn Value
A ban information of login respons.
Discussion
Usage Example
- (void)onButtonGettingIDPProfile { TCGBBanInfo* banInfo = [TCGBGamebase banInfo]; NSLog(@“BanInfo = %@”, [banInfo debugDescription]); }
Declared In
TCGBGamebase.h
+ addServerPushEvent:
Method that add an event handler to receive server push from Gamebase Server.
+ (void)addServerPushEvent:(void ( ^ ) ( TCGBServerPushMessage *))handlerAvailability
Added 1.8.0.
Discussion
Usage Example
- (void)addServerPushEventHandler { void(^pushHandler)(TCGBServerPushMessage ) = ^(TCGBServerPushMessage message) { NSString* msg = [NSString stringWithFormat:@“[Sample] receive server push =>\ntype: %@\ndata: %@”, message.type, message.data]; [self printLogAndShowAlertWithData:msg error:nil alertTitle:@“server push”]; }; [TCGBGamebase addServerPushEvent:pushHandler]; }
Declared In
TCGBGamebase.h
+ removeServerPushEvent:
Method that remove an event handler.
+ (void)removeServerPushEvent:(void ( ^ ) ( TCGBServerPushMessage *))handlerAvailability
Added 1.8.0.
Discussion
Usage Example
- (void)removeServerPushEventHandler { void(^pushHandler)(TCGBServerPushMessage ) = ^(TCGBServerPushMessage message) { NSString* msg = [NSString stringWithFormat:@“[Sample] receive server push =>\ntype: %@\ndata: %@”, message.type, message.data]; [self printLogAndShowAlertWithData:msg error:nil alertTitle:@“server push”]; }; [TCGBGamebase removeServerPushEvent:pushHandler]; }
Declared In
TCGBGamebase.h
+ removeAllServerPushEvent
Method that remove all handlers.
+ (void)removeAllServerPushEventAvailability
Added 1.8.0.
Declared In
TCGBGamebase.h
+ addObserver:
Method that add an observer handler to notify status changed by LaunchingStatus, Network Monitoring, User Info (ban). You can see the constants of message type in TCGBConstants.h (kTCGBObserverMessageTypeNetwork, kTCGBObserverMessageTypeLaunching, kTCGBObserverMessageTypeHeartbeat).
+ (void)addObserver:(void ( ^ ) ( TCGBObserverMessage *))handlerAvailability
Added 1.8.0.
Discussion
Usage Example
(void)addObserverHandler { void(^observerHandler)(TCGBObserverMessage ) = ^(TCGBObserverMessage message) { NSString* msg = [NSString stringWithFormat:@“[Sample] receive from observer =>\ntype: %@\ndata: %@”, message.type, message.data]; [self printLogAndShowAlertWithData:msg error:nil alertTitle:@“Observer”]; };
[TCGBGamebase addObserver:observerHandler]; }
Declared In
TCGBGamebase.h
+ removeObserver:
Method that remove an observer handler.
+ (void)removeObserver:(void ( ^ ) ( TCGBObserverMessage *))handlerAvailability
Added 1.8.0.
Discussion
Usage Example
(void)removeObserverHandler { void(^observerHandler)(TCGBObserverMessage ) = ^(TCGBObserverMessage message) { NSString* msg = [NSString stringWithFormat:@“[Sample] receive from observer =>\ntype: %@\ndata: %@”, message.type, message.data]; [self printLogAndShowAlertWithData:msg error:nil alertTitle:@“Observer”]; };
[TCGBGamebase removeObserver:observerHandler]; }
Declared In
TCGBGamebase.h
+ removeAllObserver
Method that remove all observer handlers.
+ (void)removeAllObserverAvailability
Added 1.8.0.
Declared In
TCGBGamebase.h
+ addEventHandler:
Use this method to add handler for receiving event from ServerPush, Observer, RemoteNotification (foreground), AppStore Promoting IAP Purchase Result.
+ (void)addEventHandler:(GamebaseEventHandler)handlerParameters
handler |
Handler to receive Event |
|---|
Availability
Added 2.10.0
Discussion
Usage Example
(void)eventHandler_addEventHandler { void(^eventHandler)(TCGBGamebaseEventMessage *) = ^(TCGBGamebaseEventMessage * _Nonnull message) { NSLog(@“Received Message => %@”, message); };
static NSInteger count = 1; _gamebaseEventHandlers[@(count++)] = eventHandler;
[TCGBGamebase addEventHandler:eventHandler]; }
Declared In
TCGBGamebase.h
+ removeEventHandler:
Use this method to remove handler for receiving event from ServerPush, Observer, RemoteNotification (foreground), AppStore Promoting IAP Purchase Result.
+ (void)removeEventHandler:(GamebaseEventHandler)handlerParameters
handler |
Handler to remove |
|---|
Availability
Added 2.10.0
Discussion
Usage Example
- (void)eventHandler_removeEventHandler { [TCGBGamebase removeEventHandler:self->gamebaseEventHandlers[n]]; [self->gamebaseEventHandlers removeObjectForKey:n]; }
Declared In
TCGBGamebase.h
+ removeAllEventHandler
Use this method to remove all handlers for receiving event from ServerPush, Observer, RemoteNotification (foreground), AppStore Promoting IAP Purchase Result.
+ (void)removeAllEventHandlerAvailability
Added 2.10.0
Discussion
Usage Example
- (void)eventHandler_removeAllEventHandler { [TCGBGamebase removeAllEventHandler]; }
Declared In
TCGBGamebase.h
+ queryTransferAccountWithCompletion:
Use this method to retrieve already published Transfer Account information.
+ (void)queryTransferAccountWithCompletion:(nullable TransferAccountCompletion)completionParameters
completion |
Handler to receive TransferAccount inforamtion. |
|---|
Availability
Added 2.1.0.
Discussion
Usage Example
- (void)queryTransferAccount { [TCGBGamebase queryTransferAccountWithCompletion:^(TCGBTransferAccountInfo transferAccount, TCGBError error) { NSLog(@“Published TransferAccount => %@, error => %@”, [transferAccount description], [error description]); }]; }
Declared In
TCGBGamebase.h
+ issueTransferAccountWithCompletion:
If you want to transfer an account that is guest to other device. You can use this method to publish id and password that called Transfer Account. To publish Transfer Account, an account must be logged in by Guest. After transfering guest account to other device, guest account on this device will be logged out and will not be able to authenticate with same guest account.
+ (void)issueTransferAccountWithCompletion:(nullable TransferAccountCompletion)completionParameters
completion |
Handler to receive TransferAccount inforamtion and an error. |
|---|
Availability
Added 2.1.0.
Discussion
Usage Example
- (void)issueTransferAccount { [TCGBGamebase issueTransferAccountWithCompletion:^(TCGBTransferAccountInfo transferAccount, TCGBError error) { NSLog(@“Issued TransferAccount => %@, error => %@”, [transferAccount description], [error description]); }]; }
Declared In
TCGBGamebase.h
+ renewTransferAccountWithConfiguration:completion:
Use this method to change Transfer Account id or password.
+ (void)renewTransferAccountWithConfiguration:(TCGBTransferAccountRenewConfiguration *)config completion:(nullable TransferAccountCompletion)completionParameters
config |
Configuration for Transfer Account renewal. |
|---|---|
completion |
Handler to receive TransferAccount inforamtion and an error. |
Availability
Added 2.1.0
Declared In
TCGBGamebase.h
+ transferAccountWithIdPLoginWithAccountId:accountPassword:completion:
This method transfer the guest account to other device. If result is success, the guest account can be logged in to new device and logged out from old device.
+ (void)transferAccountWithIdPLoginWithAccountId:(NSString *)accountId accountPassword:(NSString *)accountPassword completion:(nullable void ( ^ ) ( TCGBAuthToken *_Nullable authToken , TCGBError *_Nullable error ))completionParameters
accountId |
TransferAccount id received from old device. |
|---|---|
accountPassword |
TransferAccount password from old device. |
completion |
Handler that include guest login informations and errors. |
Availability
Added 2.1.0.
Discussion
Usage Example
- (void)transferOtherDevice { [TCGBGamebase transferAccountWithIdPLoginWithAccountId:@“1Aie0198” accountPassword:@“1Aie0199” completion:^(TCGBAuthToken authToken, TCGBError error) { NSLog(@“Transfered => %@”,\nerror => %@“, [authToken description], [error description]); }]; }
Declared In
TCGBGamebase.h
+ application:willFinishLaunchingWithOptions:
If you implement custom AuthAdapter with TCGBAuthAdapterDelegate to support custom IDPs and you need to be called ‘application:willFinishLaunchingWithOptions:’ in your adapter class. This method must be called in ‘UIApplicationDelegate application:willFinishLaunchingWithOptions:’ method.
+ (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptionsParameters
application |
Your singleton app object from UIApplication. |
|---|---|
launchOptions |
A dictionary indicating the reason the app will launch. |
Discussion
This method is optional.
Usage Example
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return [TCGBGamebase application:application willFinishLaunchingWithOptions:launchOptions];
}
Declared In
TCGBGamebase.h
+ application:didFinishLaunchingWithOptions:
If you implement custom AuthAdapter with TCGBAuthAdapterDelegate to support custom IDPs and you need to be called ‘application:didFinishLaunchingWithOptions:’ in your adapter class. This method must be called in ‘UIApplicationDelegate application:didFinishLaunchingWithOptions:’ method.
+ (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptionsParameters
application |
Your singleton app object from UIApplication. |
|---|---|
launchOptions |
A dictionary indicating the reason the app was launched. |
Discussion
This method is optional.
Usage Example
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return [TCGBGamebase application:application didFinishLaunchingWithOptions:launchOptions];
}
Declared In
TCGBGamebase.h
+ application:didReceiveRemoteNotification:fetchCompletionHandler:
Responding to Notifications and Events
+ (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult result ))completionHandlerDeclared In
TCGBGamebase.h
+ application:openURL:options:
If you implement custom AuthAdapter with TCGBAuthAdapterDelegate to support custom IDPs and you need to be called ‘application:openURL:options:’ in your adapter class. This method must be called in ‘UIApplicationDelegate application:openURL:options:’ method.
+ (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)optionsParameters
app |
Your singleton app object from UIApplication. |
|---|---|
url |
The URL resource to open. |
options |
A dictionary of URL handling options. |
Return Value
YES if the delegate sucessfully handled the request or NO if the attempt to open the URL resource failed.
Availability
iOS 9.0 <=
Discussion
This method is optional.
Usage Example
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
return [TCGBGamebase application:app openURL:url options:options];
}
Declared In
TCGBGamebase.h
+ application:openURL:sourceApplication:annotation:
If you implement custom AuthAdapter with TCGBAuthAdapterDelegate to support custom IDPs and you need to be called ‘application:openURL:sourceApplication:annotation:’ in your adapter class. This method must be called in ‘UIApplicationDelegate application:openURL:sourceApplication:annotation:’ method.
+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotationParameters
application |
Your singleton app object from UIApplication. |
|---|---|
url |
The URL resource to open. |
sourceApplication |
The bundle ID of the app that is requesting your app to open the URL. |
annotation |
A Property list supplied by the source app to communicate information to the receiving app. |
Return Value
YES if the delegate sucessfully handled the request or NO if the attempt to open the URL resource failed.
Availability
iOS 4.2 ~ 8.x
Discussion
This method is optional.
Usage Example
+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [TCGBGamebase application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
Declared In
TCGBGamebase.h
+ application:handleOpenURL:
If you implement custom AuthAdapter with TCGBAuthAdapterDelegate to support custom IDPs and you need to be called ‘application:handleOpenURL:’ in your adapter class. This method must be called in ‘UIApplicationDelegate application:handleOpenURL:’ method.
+ (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)urlParameters
application |
Your singleton app object from UIApplication. |
|---|---|
url |
The URL resource to open. |
Return Value
YES if the delegate sucessfully handled the request or NO if the attempt to open the URL resource failed.
Availability
iOS 4.2 ~ 8.x
Discussion
This method is optional.
Usage Example
+ (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [TCGBGamebase application:application handleOpenURL:url];
}
Declared In
TCGBGamebase.h
+ application:continueUserActivity:restorationHandler:
If you implement custom AuthAdapter with TCGBAuthAdapterDelegate to support custom IDPs and you need to be called ‘application:continueUserActivity:restorationHandler:’ in your adapter class. This method must be called in ‘UIApplicationDelegate application:continueUserActivity:restorationHandler:’ method.
+ (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void ( ^ ) ( NSArray<id<UIUserActivityRestoring> > *__nullable restorableObjects ))restorationHandlerParameters
application |
The shared app object that controls and coordinates your app. |
|---|---|
userActivity |
The activity object containing the data associated with the task the user was performing. Use the data to continue the user’s activity in your iOS app. |
restorationHandler |
A block to execute if your app creates objects to perform the task the user was performing. Calling this block is optional and you can copy this block and call it at a later time. When calling a saved copy of the block, you must call it from the app’s main thread. This block has no. return value and takes the following parameter:. |
Return Value
YES to indicate that your app handled the activity or NO to let iOS know that your app didn’t handle the activity.
Discussion
This method is optional.
Usage Example
+ (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {\
return [TCGBGamebase application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
Declared In
TCGBGamebase.h
+ application:didDiscardSceneSessions:API_AVAILABLE:
This method must be called in ‘UIApplicationDelegate application:didDiscaredSceneSessions:’ method.
+ (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession*> *)sceneSessions API_AVAILABLEParameters
application |
Your singleton app object from UIApplication. |
|---|---|
sceneSessions |
The session objects associated with the discarded scens. |
Discussion
This method is optional.
Usage Example
- (void)application:(UIApplication )application didDiscardSceneSessions:(NSSet
)sceneSessions { [TCGBGamebase application:application didDiscaredSceneSessions:sceneSessions]; }
Declared In
TCGBGamebase.h
+ scene:willConnectToSession:options:API_AVAILABLE:
This method must be called in ‘UISceneDelegate scene:willConnectToSession:options:’ method.
+ (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions API_AVAILABLEParameters
scene |
The scene object being connected to your app. |
|---|---|
session |
The session object containing details about the scene’s configuration. |
connectionOptions |
Additional options for configuring the scene. |
Discussion
This method is optional.
Usage Example
- (void)scene:(UIScene )scene willConnectToSession:(UISceneSession )session options:(UISceneConnectionOptions *)connectionOptions { [TCGBGamebase scene:scene willConnectToSession:session options:connectionOptions]; }
Declared In
TCGBGamebase.h
+ sceneDidDisconnect:API_AVAILABLE:
This method must be called in ‘UISceneDelegate sceneDidDisconnect:’ method.
+ (void)sceneDidDisconnect:(UIScene *)scene API_AVAILABLEParameters
scene |
The scene that UIKit disconnected from your app. |
|---|
Discussion
This method is optional.
Usage Example
- (void)sceneDidDisconnect:(UIScene *)scene { [TCGBGamebase sceneDidDisconnect:scene]; }
Declared In
TCGBGamebase.h
+ sceneDidBecomeActive:API_AVAILABLE:
This method must be called in ‘UISceneDelegate sceneDidBecomeActive:’ method.
+ (void)sceneDidBecomeActive:(UIScene *)scene API_AVAILABLEParameters
scene |
The scene that became active and is now responding to user events. |
|---|
Discussion
This method is optional.
Usage Example
- (void)sceneDidBecomeActive:(UIScene *)scene { [TCGBGamebase sceneDidBecomeActive:scene]; }
Declared In
TCGBGamebase.h
+ sceneWillResignActive:API_AVAILABLE:
This method must be called in ‘UISceneDelegate sceneWillResignActive:’ method.
+ (void)sceneWillResignActive:(UIScene *)scene API_AVAILABLEParameters
scene |
The scene that became active and is now responding to user events. |
|---|
Discussion
This method is optional.
Usage Example
- (void)sceneWillResignActive:(UIScene *)scene { [TCGBGamebase sceneWillResignActive:scene]; }
Declared In
TCGBGamebase.h
+ sceneWillEnterForeground:API_AVAILABLE:
This method must be called in ‘UISceneDelegate sceneWillEnterForeground’ method.
+ (void)sceneWillEnterForeground:(UIScene *)scene API_AVAILABLEParameters
scene |
The scene that became active and is now responding to user events. |
|---|
Discussion
This method is optional.
Usage Example
- (void)sceneWillEnterForeground:(UIScene *)scene { [TCGBGamebase sceneWillEnterForeground:scene]; }
Declared In
TCGBGamebase.h
+ sceneDidEnterBackground:API_AVAILABLE:
This method must be called in ‘UISceneDelegate sceneDidEnterBackground’ method.
+ (void)sceneDidEnterBackground:(UIScene *)scene API_AVAILABLEParameters
scene |
The scene that entered the background. |
|---|
Discussion
This method is optional.
Usage Example
- (void)sceneDidEnterBackground:(UIScene *)scene { [TCGBGamebase sceneDidEnterBackground:scene]; }
Declared In
TCGBGamebase.h
+ scene:openURLContexts:API_AVAILABLE:
This method must be called in ‘UISceneDelegate scene:openURLContexts:’ method.
+ (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext*> *)URLContexts API_AVAILABLEParameters
scene |
The scene that UIKit asks to open the URL. |
|---|---|
URLContexts |
Each object contains one URL to open and any additional information needed to open that URL. |
Discussion
This method is optional.
Usage Example
- (void)scene:(UIScene )scene openURLContexts:(NSSet
)URLContexts { [TCGBGamebase scene:scene openURLContexts:URLContexts]; }
Declared In
TCGBGamebase.h
deprecated Methods
+ languageCode
As of release 1.14.0, use deviceLanguageCode method instead. (Deprecated: As of release 1.14.0, use deviceLanguageCode method instead.)
+ (NSString *)languageCodeAvailability
Added 1.4.0.
Declared In
TCGBGamebase.h
+ carrierCode
As of release 2.52.0, returns nil since iOS 16.4. (Deprecated: As of release 2.52.0, returns nil since iOS 16.4.)
+ (nullable NSString *)carrierCodeReturn Value
Cellular service provider’s code.
Availability
Added 1.4.0.
Declared In
TCGBGamebase.h
+ carrierName
As of release 2.52.0, returns nil since iOS 16.4. (Deprecated: As of release 2.52.0, returns nil since iOS 16.4.)
+ (nullable NSString *)carrierNameReturn Value
Cellular service provider’s name.
Availability
Added 1.4.0.
Declared In
TCGBGamebase.h
+ countryCode
As of release 2.52.0, use deviceCountryCode method instead. (Deprecated: As of release 2.52.0, use deviceCountryCode method instead.)
+ (NSString *)countryCodeReturn Value
ISO country code. First, usimCountryCode is returned, if there is not usim, deviceCountryCode is returned.
Availability
Added 1.14.0.
Declared In
TCGBGamebase.h
+ countryCodeOfUSIM
As of release 2.52.0, returns ‘ZZ’ since iOS 16.4. (Deprecated: As of release 2.52.0, returns ‘ZZ’ since iOS 16.4.)
+ (NSString *)countryCodeOfUSIMReturn Value
Usim country code is returned. If there is not usim, ‘ZZ’ is returned.
Availability
Added 1.4.0.
Declared In
TCGBGamebase.h