TCGBUtil Class Reference

Inherits from NSObject
Declared in TCGBUtil.h

Overview

The TCGBUtil class provides convenient and useful methods.

Utilities

+ gamebaseVersion

Gamebase Version

+ (NSString *)gamebaseVersion

Return Value

Gamebase Version

Declared In

TCGBUtil.h

+ idfa

IDFA, Advertising Identifier.

+ (NSString *)idfa

Return Value

IDFA, Advertising Identifier.

Declared In

TCGBUtil.h

+ idfv

IDFV, Vendor Identifier.

+ (NSString *)idfv

Return Value

IDFV, Vendor Identifier.

Declared In

TCGBUtil.h

+ uuid

UUID, 4 random bytes string.

+ (NSString *)uuid

Return Value

UUID, 4 random bytes string.

Declared In

TCGBUtil.h

+ osCode

OS Code, actually “IOS”.

+ (NSString *)osCode

Return Value

OS Code, actually “IOS”.

Declared In

TCGBUtil.h

+ osVersion

OS Version.

+ (NSString *)osVersion

Return Value

OS Version.

Declared In

TCGBUtil.h

+ osVersionSeperatedByDot

OS Version dot-formatted.

+ (NSArray *)osVersionSeperatedByDot

Return Value

OS Version dot-formatted.

Declared In

TCGBUtil.h

+ isiOSVersion:orLater:

YES if majorVersion is greater than or equal to majorVersion.

+ (BOOL)isiOSVersion:(int)majorVersion orLater:(BOOL)later

Parameters

majorVersion

version to be compared with OS version.

later

if this value sets YES, it returns whether OS version is greater than or equal to majorVersion.

Return Value

YES if majorVersion is greater than or equal to majorVersion.

Declared In

TCGBUtil.h

+ deviceModel

Device model.

+ (NSString *)deviceModel

Return Value

Device model.

Declared In

TCGBUtil.h

+ deviceLanguage

Preferred launguage.

+ (NSString *)deviceLanguage

Return Value

Preferred launguage.

Declared In

TCGBUtil.h

+ country

ISO country code. First, usimCountryCode is returned, if there is not usim, deviceCountryCode is returned.

+ (NSString *)country

Return Value

ISO country code. First, usimCountryCode is returned, if there is not usim, deviceCountryCode is returned.

Declared In

TCGBUtil.h

+ usimCountryCode

Usim country code is returned. If there is not usim, “ZZ” is returned.

+ (NSString *)usimCountryCode

Return Value

Usim country code is returned. If there is not usim, “ZZ” is returned.

Declared In

TCGBUtil.h

+ deviceCountryCode

Locale country code is returned.

+ (NSString *)deviceCountryCode

Return Value

Locale country code is returned.

Declared In

TCGBUtil.h

+ carrierCode

Cellular service provider’s code.

+ (NSString *)carrierCode

Return Value

Cellular service provider’s code.

Declared In

TCGBUtil.h

+ carrierName

Cellular service provider’s name.

+ (NSString *)carrierName

Return Value

Cellular service provider’s name.

Declared In

TCGBUtil.h

+ bundleID

Main bundle’s identifier.

+ (NSString *)bundleID

Return Value

Main bundle’s identifier.

Declared In

TCGBUtil.h

+ unixEpochTime

Unix epoch time, it is millisecods, 13 digits.

+ (uint64_t)unixEpochTime

Return Value

Unix epoch time, it is millisecods, 13 digits.

Declared In

TCGBUtil.h

+ extractValueFrom:searchString:

value object which is in the json formatted dictionary and have a dottedString key.

+ (id)extractValueFrom:(NSDictionary *)json searchString:(NSString *)dottedString

Return Value

value object which is in the json formatted dictionary and have a dottedString key.

## Example
NSDictionary json;
json = @{
    @"key1" : @"value1",
    @"key2" : @{
        @"key2-1" : @"value2-1",
        @"key2-2" : @[@"value2-2[0]", @"value2-2[1]"]
    },
    @"key3" : @"value3"
}

NSString *dottedString = @"key2.key2-2[1]";
NSString *extractedString = [TCGBUtil extractValueFrom:json searchString:dottedString];
NSLog(@"%@", extractedString);
// It would be > "value2-2[1]"

Declared In

TCGBUtil.h

Encoding

+ isURLEncoded:

YES if the targetString is URL encoded.

+ (BOOL)isURLEncoded:(NSString *)targetString

Return Value

YES if the targetString is URL encoded.

Declared In

TCGBUtil.h

+ URLEncodedString:

URL Encoded String.

+ (NSString *)URLEncodedString:(NSString *)string

Parameters

string

The string to be encoded.

Return Value

URL Encoded String.

Declared In

TCGBUtil.h

+ URLEncodedStringWithData:

URL Encoded String.

+ (NSString *)URLEncodedStringWithData:(NSData *)data

Parameters

data

The data to be encoded.

Return Value

URL Encoded String.

Declared In

TCGBUtil.h

System UI

+ showToastWithMessage:duration:

Show Toast.

+ (void)showToastWithMessage:(NSString *)message duration:(NSTimeInterval)duration

Parameters

message

The message to be shown in the toast.

duration

The time interval to be exposed.

Declared In

TCGBUtil.h

+ showToastWithMessage:length:

Show Toast.

+ (void)showToastWithMessage:(NSString *)message length:(GamebaseToastLength)length

Parameters

message

The message to be shown in the toast.

length

The time interval to be exposed. GamebaseToastLengthLong (3.5 seconds), GamebaseToastLengthShort (2 seconds)

Declared In

TCGBUtil.h

+ showAlertWithTitle:message:completion:

Show Alert View with async completion handler

+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message completion:(void ( ^ ) ( void ))completion

Parameters

title

The title of alert

message

The message of alert

completion

The callback of alert when user has tapped the ‘OK(확인)’ button

Declared In

TCGBUtil.h

+ showAlertWithTitle:message:

Show Alert View

+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message

Parameters

title

The title of alert

message

The message of alert

Declared In

TCGBUtil.h

+ showAlertWithTitle:message:blocks:

Show Alert.

+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message blocks:(NSDictionary<NSString*,alertActionBlock> *)alertActionBlocks

Parameters

title

The title to be shown in the alert.

message

The message to be shown in the alert.

alertActionBlocks

The block to be set to UIAlertView or UIAlertController according to ios version.

Declared In

TCGBUtil.h

+ showAlertWithTitle:message:positiveTitle:positiveBlock:negativeTitle:negativeBlock:

Show Alert.

+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message positiveTitle:(NSString *)positiveTitle positiveBlock:(alertActionBlock)positiveBlock negativeTitle:(NSString *)negativeTitle negativeBlock:(alertActionBlock)negativeBlock

Parameters

title

The title to be shown in the alert.

message

The message to be shown in the alert.

positiveTitle

The positive button title to be shown in the alert.

positiveBlock

The positive block to be executed after click positive button.

negativeTitle

The negative button title to be shown in the alert.

negativeBlock

The negative block to be executed after click negative button.

Discussion

‘alertActionBlocks’ The block to be set to UIAlertView or UIAlertController according to ios version.

Declared In

TCGBUtil.h

Logging

+ logVerboseWithFormat:

Verbose Log

+ (void)logVerboseWithFormat:(NSString *)format, ...

Parameters

format

Log

Declared In

TCGBUtil.h

+ logDebugWithFormat:

Debug Log

+ (void)logDebugWithFormat:(NSString *)format, ...

Parameters

format

Log

Declared In

TCGBUtil.h

+ logInfoWithFormat:

Info Log

+ (void)logInfoWithFormat:(NSString *)format, ...

Parameters

format

Log

Declared In

TCGBUtil.h

+ logWarnWithFormat:

Warning Log

+ (void)logWarnWithFormat:(NSString *)format, ...

Parameters

format

Log

Declared In

TCGBUtil.h

+ logErrorWithFormat:

Error Log

+ (void)logErrorWithFormat:(NSString *)format, ...

Parameters

format

Log

Declared In

TCGBUtil.h

+ logWithString:

Log

+ (void)logWithString:(NSString *)logString

Parameters

logString

Log

Discussion

Warning: If os version is greater than or equal to ios 10.

Declared In

TCGBUtil.h

+ osLog:

OS Log

+ (void)osLog:(NSString *)newString

Parameters

newString

Log

Discussion

Warning: It can be only used in ios 10.

Declared In

TCGBUtil.h