iOS SDK

Prev Next

Available in Classic and VPC

This page describes how to use the GAMEPOT iOS SDK for game development for iOS. You can integrate the game and dashboard by installing the SDK and configuring the environment.

Required specifications

The recommended specifications required to use the GAMEPOT SDK for iOS are as follows:

  • Minimum specifications: iOS 10.0 or later
  • Development environment: Xcode

Install SDK and configure environment

You can install the GAMEPOT iOS SDK, configure the environment, and integrate the game and GAMEPOT dashboard to use features required for the game development.

The GAMEPOT SDK supports the following languages.

  • English, Italian, Thai, Vietnamese, Japanese, Chinese (Simplified/Traditional), Indonesian, German, Spanish, French, and Korean

When the app is launched, it is displayed in the supported language in the SDK based on the device's language. If it is an unsupported language, it will be displayed in English.
You need to add the language you want to apply in Xcode > localization.

Upon building, the Version Code must increase in a unique form of whole numbers.

SDK installation

The following describes how to install GAMEPOT iOS SDK and configure a project in Xcode.

  1. Click the download link from Download GAMEPOT SDK > iOS.
  2. Run Xcode, and open the game project.
  3. Decompress the downloaded SDK file, and then drag-and-drop it to the folder of the created project.

Add dependencies and bundle resources

See the table shown below to add dependencies and bundle resources suitable for the service to Xcode, to use the SDK.

Service Framework Dependencies Bundle Resource
Base AFNetworking.framework
FirebaseAnalytics.framework
FirebaseCore.framework
FirebaseCoreDiagnostics.framework
FirebaseInstanceID.framework
FirebaseMessaging.framework
FirebaseNanoPB.framework
GamePot.framework
GoogleToolboxForMac.framework
nanopb.framework
Protobuf.framework
libz.tbd WebKit.framework
UserNotifications.framework
GamePot.bundle
Login Base
GamePotChannel.framework

Google Sign In
GamePotGoogleSignIn.framework
GoogleSignIn.framework
GoogleSignInDependencies.framework

Facebook
FBAEMKit.xcframework
FBSDKCoreKit_Basics.xcframework
FBSDKCoreKit.xcframework
FBSDKLoginKit.xcframework
GamePotFacebook.framework

LINE
GamePotLine.framework
LineSDK.framework
LineSDKObjC.framework

NAVER
GamePotNaver.framework
NaverThirdPartyLogin.framework

Google Sign In
AuthenticationServices.framework
LocalAuthentication.framework

Facebook
SafariServices.framework

LINE
SafariServices.framework

Google Sign In
GoogleSignIn.bundle
GameCenter GamePotGameCenter.framework
AppleID GamePotApple.framework

Add and set information property list

To use the SDK, you need to add information property lists to Xcode and set it up.

Since GAMEPOT iOS SDK uses Google Firebase, you need to add the information property list acquired from the Firebase console, as well as the information property list that includes the SDK's default settings.

The following describes how to add and set information property lists.

  1. Add the GamePotConfig-Info.plist file included in the downloaded SDK file to the project.

    • If the file does not exist, then create a file with the same name and enter the value for the key.
  2. Add the GoogleService-Info.plist file acquired from the Google Firebase console to the project.

  3. In Xcode, change the following settings in the added GamePotConfig-Info.plist.

    • gamepot_project_id: GAMEPOT project ID
    • gamepot_elsa_projectid: (optional) GAMEPOT log project ID
  4. Click the Targets > Info > Custom iOS target properties menus, in that order, and then add the following option for acquiring user permissions.

    • The user permission is used for the Upload files feature in the GAMEPOT customer center.
      NSCameraUsageDescription, NSPhotoLibraryUsageDescription, NSMicrophoneUsageDescription

    • Starting with iOS 14, permissions must be granted by the user to acquire IDFA values. Therefore, if you're using a pop-up to acquire permissions from the user when acquiring the IDFA value, then you need to add the option to acquire following user permission in Targets >> Info >> Custom iOS Target Properties. (Purpose for collection and description of where it should be used must be added.)
      NSUserTrackingUsageDescription

  5. Add the following setting only when the GAMEPOT Dashboard creation Region is Singapore.

    • gamepot_region: sg
  6. Add the following setting only when the GAMEPOT Dashboard creation Region is Japan.

    • gamepot_license_url: https://gamepot.apigw.ntruss.com/fw/jp-v1

Add the Build Settings option

To use the SDK, you need to add the -ObjC -lz -lstdc++ -lc++ option to the Xcode Build Settings.

To add the option, click the Build Settings > Linking > Other Linker Flags menus, in that order in Xcode, and then add the -ObjC -lz -lstdc++ -lc++option.

Set up login environment

To set up login environment per account, you need to add settings appropriate for the Xcode project.

Facebook login environment

After completing the addition of Dependencies, you can set up Facebook login environment.

The following describes how to set up Facebook login environment.

  1. From the Facebook for Developers console, select the app type as None, Consumer, or Gaming, and create the app.
  2. Add the Facebook app ID value to the Info > URL Types menu in Xcode in the form of "fb{Facebook app ID} (e.g., fb561593141718906).
  3. Click the Info > iOS Target Property menus in that order, and then add the following settings to LSApplicationQueriesSchemes.
    • fbapi, fb-messenger-share-api, fbauth2, fbshareextension, fb-messenger-api
  4. Change the following settings in GamePotConfig-Info.plist.
    • gamepot_facebook_app_id: Facebook App ID
    • gamepot_facebook_display_name: Facebook display name
    • gamepot_facebook_client_token: Facebook console > App > Settings > Advanced settings > Client token

Set up Google Sign In, LINE, Twitter, NAVER, and Apple ID login environment

After adding Dependencies and BundleResource, you can set up the login environment for each account.

To set up login environment per account, you need to add the following settings to the Xcode project.

  • Google Sign In
    • Copy theREVERSED_CLIENT_ID value in the GoogleService-Info.plist file, click the Info > URL Types menus, in that order in Xcode, and then add an item and enter the copied value to URL Schemes.
    • Change the following settings in GamePotConfig-Info.plist
      gamepot_google_app_id: GoogleService-Info.plist file's CLIENT_ID value
      gamepot_google_url_schemes: GoogleService-Info.plist file's REVERSED_CLIENT_ID value

  • LINE
    • Change the following settings in GamePotConfig-Info.plist
      gamepot_line_channelid: Line Channel ID
      gamepot_line_url_schemes: LINE URL scheme (line3rdp.{project bundle ID})

    • Click the Info > iOS Target Property menus in that order, and then add the following settings to LSApplicationQueriesSchemes.
      lineauth2


  • NAVER
    • Change the following settings in GamePotConfig-Info.plist
      gamepot_naver_clientid: Naver Client Id
      gamepot_naver_secretid: Naver Secret Id
      gamepot_naver_urlscheme: Naver URL Scheme
    • Add the following settings to LSApplicationQueriesSchemes in the Info > iOS Target Property menu.
      naversearchapp, naversearchthirdlogin, navercafe
    • Add the same value as gamepot_naver_urlscheme to the Info > URL Types menu.

  • Apple ID
    • Select the target, and then add the Sign In with Apple Capability in the Signing & Capabilities menu.

Reset

Use the following code in the AppDelegate file to reset.

#import <GamePot/GamePot.h>

#if __has_include(<AppTrackingTransparency/AppTrackingTransparency.h>)
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#endif


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    // GamePot SDK Initialize
    [[GamePot getInstance] setup];

    // Push Permission
    if(SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10.0"))
    {
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        center.delegate = self;
        [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
            if(!error){
                dispatch_async(dispatch_get_main_queue(), ^{
                    [[UIApplication sharedApplication] registerForRemoteNotifications];
                });
            }
        }];
    }
    else
    {
        // Code for old versions
        UIUserNotificationType allNotificationTypes = (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
        [application registerUserNotificationSettings:settings];
        [application registerForRemoteNotifications];
    }

// Call permission request pop-up to get the IDFA value in the iOS 14 version
// It is not called if AppTrackingTransparency.framework is not added to the project.
#if __has_include(<AppTrackingTransparency/AppTrackingTransparency.h>)
   if (@available(iOS 14, *)) {
       if(NSClassFromString(@"ATTrackingManager"))
       {
           // If the listener is not registered, then the request pop-up does not occur.
           [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {

               switch (status)
               {
                   case ATTrackingManagerAuthorizationStatusNotDetermined:
                       break;
                   case ATTrackingManagerAuthorizationStatusRestricted:
                       break;
                   case ATTrackingManagerAuthorizationStatusDenied:
                       break;
                   case ATTrackingManagerAuthorizationStatusAuthorized:
                       break;
                   default:
                       break;
               }
           }];
       }
   }
#endif
    ...
}

 // Push
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    ...
    [[GamePot getInstance] handleRemoteNotificationsWithDeviceToken:deviceToken];
    ...
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    [[GamePotChat getInstance] start];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    [[GamePotChat getInstance] stop];
}

Login-related features

You can integrate various login SDK features such as Google, Facebook, and NAVER, and use them in GAMEPOT iOS SDK.

Twitter login is not supported.

Settings before use

To use the login-related SDK features, use the following code to AppDelegate and configure settings first.

// AppDelegate.m
#import <GamePotChannel/GamePotChannel.h>

// For Google Login
#import <GamePotGoogleSignIn/GamePotGoogleSignIn.h>

// When using Facebook login
#import <GamePotFacebook/GamePotFacebook.h>

// For AppleID Login
#import <GamePotApple/GamePotApple.h>

// For LINE Login
#import <GamePotLine/GamePotLine.h>

// For Twitter Login - Unsupported
#import <GamePotTwitter/GamePotTwitter.h>

// For NAVER Login
#import <GamePotNaver/GamePotNaver.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    // Reset the GamePotSDK channel. Use addChannel for each channel you want to use, and Guest type is included by default.
    // Initialize Google login
    GamePotChannelInterface* google     = [[GamePotGoogleSignIn alloc] init];
    [[GamePotChannelManager getInstance] addChannelWithType:GOOGLE interface:google];

    // Initialize Facebook login
    GamePotChannelInterface* facebook   = [[GamePotFacebook alloc] init];
    [[GamePotChannelManager getInstance] addChannelWithType:FACEBOOK interface:facebook];

    // Initialize AppleID login.
    GamePotChannelInterface* apple      = [[GamePotApple alloc] init];
    [[GamePotChannel getInstance] addChannelWithType:APPLE interface:apple];

    // Initialize LINE login.
    GamePotChannelInterface* line = [[GamePotLine alloc] init];
    [[GamePotChannel getInstance] addChannelWithType:LINE interface:line];

    // Reset Twitter login - Unsupported
    GamePotChannelInterface* twitter = [[GamePotTwitter alloc] init];
    [[GamePotChannel getInstance] addChannelWithType:TWITTER interface:twitter];

      // Initialize NAVER login.
      GamePotChannelInterface* naver = [[GamePotNaver alloc] init];
      [[GamePotChannel getInstance] addChannelWithType:NAVER interface:naver];

    // Required for login processing.
    [[GamePotChannel getInstance] application:application didFinishLaunchingWithOptions:launchOptions];

    ...
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    // Required for login processing.
    BOOL nChannelResult = [[GamePotChannel getInstance] application:app openURL:url options:options];
    return nChannelResult;
}

Login feature

Use the following code to use the SDK login feature that functions when clicking the login button according to the login UI implemented by the developer.

#import <GamePotChannel/GamePotChannel.h>
// Define login type.
// GamePotChannelType.GOOGLE
// GamePotChannelType.FACEBOOK
// GamePotChannelType.GUEST
// GamePotChannelType.LINE
// GamePotChannelType.TWITTER - Unsupported
// GamePotChannelType.NAVER
// GamePotChannelType.APPLE

// Call when Google login button is clicked
[[GamePotChannel getInstance] Login:GOOGLE viewController:self success:^(GamePotUserInfo* userInfo) {
    // Login completed
} cancel:^{
    // The user canceled while attempting login
} fail:^(NSError *error) {
    // Error occurs during login
    // TODO: Display a pop-up message regarding reasons for failure with a game pop-up.
    // TODO: Use [error localizedDescription] for the message text.
}];

Auto login feature

To use the auto login feature through the API that delivers the last login information of the member, use the following code.

#import <GamePotChannel/GamePotChannel.h>

// lastLoginType: Retrieves the last login value.
GamePotChannelType type = [[GamePotChannel getInstance] lastLoginType];

if(type != NONE)
{
    // Log in with the user's last login type.
    // Call the following to perform auto login.
    [[GamePotChannel getInstance] Login:type viewController:self success:^(GamePotUserInfo* userInfo) {

    } cancel:^{

    } fail:^(NSError *error) {
        // Display a pop-up message regarding reasons for failure with a game pop-up.
        // Use [error localizedDescription] for the message text.
    }];
}
else
{
    // There is no last login information. Move to the login screen where the user can log in.
}

Logout feature

Use the following code to use the logout feature.

#import <GamePotChannel/GamePotChannel.h>

[[GamePotChannel getInstance] LogoutWithSuccess:^{
    // Move to the initial screen after logout is completed.
} fail:^(NSError *error) {
    // Logout failed. Display a pop-up message regarding reasons for failure with a game pop-up.
    // Use [error localizedDescription] for the message text.
}];

Membership withdrawal feature

Use the following code to use the membership withdrawal feature.

#import <GamePotChannel/GamePotChannel.h>

[[GamePotChannel getInstance] DeleteMemberWithSuccess:^{
    // Membership withdrawal succeeded. Go to the login page.
} fail:^(NSError *error) {
    // Membership withdrawal failed. Display a pop-up message regarding reasons for failure with a game pop-up.
    // Use [error localizedDescription] for the message text.
}];

Login validation feature

After the login is complete, the login information can be passed from the developer server to the GAMEPOT server to perform login validation.

For more information, see Request login validation.

Integrate external account

You can connect or disconnect multiple external accounts to a game account.

Account link feature

Use the following code to use the integration feature to various external accounts including Google, Facebook, and NAVER.

#import <GamePotChannel/GamePotChannel.h>

// Define types.
// GamePotChannelType.GOOGLE
// GamePotChannelType.FACEBOOK
// GamePotChannelType.LINE
// GamePotChannelType.TWITTER
// GamePotChannelType.NAVER
// GamePotChannelType.APPLE

[[GamePotChannel getInstance] CreateLinking:GOOGLE viewController:self success:^(GamePotUserInfo *userInfo) {
    // Connection completed. Display the message about the linkage result with a game pop-up. (E.g., Account linkage succeeded.)
} cancel:^{
    // Canceled by the user
} fail:^(NSError *error) {
    // Connection failed. Display a pop-up message regarding reasons for failure with a game pop-up.
    // Use [error localizedDescription] for the message text.
}];

Linkage list check feature

Use the following code to check the list of external accounts connected to the account.

#import <GamePotChannel/GamePotChannel.h>

// Define types.
// GamePotChannelType.GOOGLE
// GamePotChannelType.FACEBOOK
// GamePotChannelType.LINE
// GamePotChannelType.TWITTER
// GamePotChannelType.NAVER
// GamePotChannelType.APPLE

// Return connection results for each type.
BOOL isGoogleLinked = [[GamePotChannel getInstance] isLinked:GOOGLE];

// Return connection types in JsonString.
NSString* linkedList = [[GamePotChannel getInstance] getLinkedListJsonString];

Linkage removal feature

Use the following code to use the integration removal feature from external accounts.

#import <GamePotChannel/GamePotChannel.h>

[[GamePotChannel getInstance] DeleteLinking:GOOGLE success:^{
     // Disconnected successfully. Display the message about the linkage result with a game pop-up. (E.g., Account linkage removed.)
} fail:^(NSError *error) {
     // Disconnection failed. Display a pop-up message regarding reasons for failure with a game pop-up.
     // Use [error localizedDescription] for the message text.
}];

Payment feature

You can use the payment feature for in-app purchases. The result value of payment is implemented as delegate format.

Set AppDelegate

Use the following code to set AppDelegate to use the payment feature.

#import <GamePot/GamePot.h>

@interface ViewController () <GamePotPurchaseDelegate>
@end
@implementation ViewController

- (void)viewDidLoad
{
    ...
    [[GamePot getInstance] setPurchaseDelegate:self];
    ...
}

- (void)GamePotPurchaseSuccess:(GamePotPurchaseInfo *)_info
{
    // Payment succeeded.
}

- (void)GamePotPurchaseFail:(NSError *)_error
{
    // Payment error. Display a pop-up message regarding reasons for failure with a game pop-up.
    // Use [error localizedDescription] for the message text.
}

- (void)GamePotPurchaseCancel
{
    // Cancellation during payment attempts.
    // Display the "The payment has been canceled." message as a game pop-up.
}
@end

Payment attempt feature

Use the following code to use the payment attempt feature.

  • General payment attempt
#import <GamePot/GamePot.h>

// productId: Enter the product ID registered in the store.
[[GamePot getInstance] purchase:productid];


  • Manage payment attempts and receipt numbers separately
#import <GamePot/GamePot.h>

// productId: enter the product ID registered in the store
// uniqueId: enter the receipt ID that is separately managed
[[GamePot getInstance] purchase:productid uniqueId:uniqueid];


  • Manage payment attempts and receipt numbers separately, deliver character information through webhook
#import <GamePot/GamePot.h>

// productId: product ID registered in the store
// uniqueId: receipt ID that is separately managed
// serverId: server ID of the character for whom the payment was made
// playerId: character ID of the character for whom the payment was made
// etc       : other information of the character that made the purchase
[[GamePot getInstance] purchase:productid uniqueId:uniqueid serverId:serverid playerId:playerid etc:etc]];

Acquire purchased item list feature

Use the following code to use the feature to acquire in-app payment item list delivered from the store.

[case1]
NSArray<SKProduct*>* itemList = [[GamePot getInstance] getDetails];

// To retrieve the price according to the device currency settings
[[GamePot getInstance] getLocalizePrice:[product productIdentifier]];

[case2]

[[GamePot getInstance] getPurchaseItemsJsonString];


[case3]

@try{
    [[GamePot getInstance] getPurchaseDetailListAsyncToJSON:^(BOOL _success, NSString *_items, NSError *_error)
    {
        if(_success)
        {
            if(_items)
            {
                // In-app information
            }
        }else
        {
            if(_error){
                // NSLog(@"Error = %@", [_error localizedDescription]);
            }
        }
    }];
}
@catch(NSException* ex){
    NSLog(@"Error : %@", ex);
}

Provide purchased item feature

You can set it so that the payment request is sent to the developer server only upon the completion of validation, which compares it to the receipt history of the purchased store.

For more information, see Request item provision.

Login UI provided by SDK

You can use the login UI provided by GAMEPOT iOS SDK in a completed form.

Set AppDelegate

Use the following code to set AppDelegate to use the provided login UI.

#import <GamePot/GamePot.h>
#import <GamePotChannel/GamePotChannel.h>

NSArray* order = @[@(GOOGLE), @(FACEBOOK), @(APPLE),@(NAVER), @(LINE), @(TWITTER), @(GUEST)];
GamePotChannelLoginOption* options = [[GamePotChannelLoginOption alloc] init:order];
[option setShowLogo:YES];

[[GamePotChannel getInstance] showLoginWithUI:self option:options success:^(GamePotUserInfo *userInfo) {
    // Login completed. Handle this according to the game logic.
            
} update:^(GamePotAppStatus *appStatus) {
        // Force update required. Call the following API to display the pop-up provided by SDK.
        // If you'd like to customize it, then you can customize it while the API is not called.
        [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
         setCloseHandler:^{
            // The showAppStatusPopup API is called when it is necessary to close the app.
            // Handle the shutdown process.
        } setNextHandler:^(NSObject* resultPayload) {
            // When you set the dashboard update as recommended, the "Do it next time" button will appear.
            // It is called when the user selects that button.
            // Handle in the same way as when login is completed, using the resultPayload information.
            // GamePotUserInfo* userInfo = (GamePotUserInfo*)resultPayload;

        }];
    } maintenance:^(GamePotAppStatus *appStatus) {
          // Under maintenance. Call the following API to display the pop-up provided by SDK.
        // If you'd like to customize it, then you can customize it while the API is not called.
        [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
         setCloseHandler:^{
            // The showAppStatusPopup API is called when it is necessary to close the app.
            // Handle the shutdown process.
        }];
    } exit:^{
    // Process when the X button is clicked
}];

Set logo image for the provided login UI

You can set the image displayed at the top of the provided login UI. If you don't set it up separately, then the default image included in the SDK is used. You can set up images that suit the game. The recommended image size is 310 x 220.

To set the provided login UI image, change file name of the image you want to set to ic_stat_gamepot_login_logo.png, and then replace it with the existing file with the same name in GamePot.bundle.

Coupon feature

Use the following code to use the feature that processes the coupon entered by the user as used.

#import <GamePot/GamePot.h>

[[GamePot getInstance] coupon: /*Coupon entered by user*/ handler:^(BOOL _success, NSError *_error) {
    if(_success)
    {
        // The coupon use is shown as a message. Display this message in a game pop-up.
    }
    else
    {
        // The reason for coupon use failure is shown in _error.
        // Display the content of [_error localizedDescription] as a pop-up message in the game.
    }
}];

Provide items

When a coupon is used successfully, it requests the provision of items to the developer server.

For more information, see Request item provision.

Push feature

You can activate or deactivate general push, night push, and ad push features.
Set ad push settings to Yes if you use the push feature. (If the ad push value is No, push messages don't come through, regardless of the general/night push settings.)

Activate and deactivate push

Use the following code to use the push feature.

#import <GamePot/GamePot.h>

// Push On/Off
[[GamePot getInstance] setPushEnable:YES success:^{

} fail:^(NSError *error) {

}];

// Night Push On/Off
[[GamePot getInstance] setNightPushEnable:YES success:^{

} fail:^(NSError *error) {

}];

// Set push/night push at the same time
// For games that check whether users will allow push/night push before login, make sure to call the following code after login.
[[GamePot getInstance] setPushStatus:YES night:YES ad:YES success:^{
    <#code#>
} fail:^(NSError *error) {
    <#code#>
}];

Image push feature

The following describes how to add the notification service extension program to receive and process notification images on the iOS app.

  1. Click the Target menu in Xcode, select Notification Service Extension, and then click Next.
  2. Enter the Project Name, and click Finish.
  3. Edit the NotificationService.h file of the created Notification Service Extension module as below.
    // Import GamePot/GamePotNotificationServiceExtension.h
    // #import <UserNotifications/UserNotifications.h>
    #import <GamePot/GamePotNotificationServiceExtension.h>
    
    // Inherit GamePotNotificationServiceExtension instead of UNNotificationServiceExtension
    // @interface NotificationService : UNNotificationServiceExtension
    @interface NotificationService : GamePotNotificationServiceExtension
    @end
    
  4. Edit the NotificationService.m file of the created Notification Service Extension module as below.
    ...
    - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
        // self.contentHandler = contentHandler;
        // self.bestAttemptContent = [request.content mutableCopy];
    
        // Modify the notification content here...
        // self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];
    
        // self.contentHandler(self.bestAttemptContent);
        [super didReceiveNotificationRequest:request withContentHandler:contentHandler];
    }
    ...
    
  5. In the created Notification Service Extension module, click the Targets > Build Phases > Link Binary With Libraries menus, in that order, and then add GamePot.framework.

Display notice image feature

You can set to display the image uploaded to the Notice menu in the dashboard. Recommended sizes for images are shown below.

  • Size: 720 x 1200 (portrait), 1280 x 640 (landscape)
  • File size: 250 KB or smaller

Use the following code to display the image uploaded to the Notice menu in the dashboard.

[[GamePot getInstance] showNotice:/*viewController*/ setSchemeHandler:^(NSString *scheme) {
    NSLog(@"scheme = %@", scheme);
}];

Display notice images of specific classification

Use the following code to only display notice images with a specific classification.

[[GamePot getInstance] showEvent:/*viewController*/ setType:/*Type*/ setSchemeHandler:^(NSString *scheme) {
    NSLog(@"scheme = %@", scheme);
}];

Support feature

By integrating the dashboard, you can use features such as customer inquiry, call policies and terms UI, and consent collection.

Customer inquiry feature

You can use the customer inquiry feature where members can send in inquiries and managers can answer them. It is integrated with the Support > Customer inquiry menu in the dashboard.

The customer inquiry UI is changed to a language among Korean, English, Japanese, Simplified Chinese, and Traditional Chinese according to the device language. If the device language is in another language, then it is changed to English.

Use the following code to use the customer inquiry feature by integrating the dashboard.

[[GamePot getInstance] showHelpWebView:(UIViewController *)];

Customer inquiry through external link

Use the following code to allow inquiry registration by customers who are not logged in, through an external link.

// showWebView Type
    // WEBVIEW_NORMAL // Back button does not exist.
    // WEBVIEW_NORMALWITHBACK // Back button exists.

    [[GamePot getInstance] showWebView:/*Current ViewController*/ setType:/*Type*/ setURL:/*External inquiry access URL*/];

Call terms and policies UI feature

You can call various terms and policies created in the Support menu in the dashboard.

Use the following code to call terms and policies UI.

  • Terms and Conditions

    #import <GamePot/GamePot.h>
    
    [[GamePot getInstance] showTerms:/*ViewController*/];
    
  • Privacy Policy

    #import <GamePot/GamePot.h>
    
    [[GamePot getInstance] showPrivacy:/*ViewController*/];
    
  • Refund policy

    #import <GamePot/GamePot.h>
    
    [[GamePot getInstance] showRefund:/*ViewController*/];
    

Agree to Terms and Conditions feature (including GDPR)

By using the provided pop-up UI feature, you can collect consent for various policies and terms created in the dashboard. You can also collect consent for the GDPR policy.

Call Agree to Terms and Conditions automatically

If you're using the GAMEPOT iOS SDK version v.3.3.0 or later, the Agree to Terms and Conditions pop-up window is automatically displayed when the user logs in.

Use the following code to change whether to automatically call Agree to Terms and Conditions upon login.

// Default value is YES
// The MATERIAL_BLUE theme is applied to the automatically displayed pop-up.
// The Agree to Terms and Conditions pop-up window does not appear upon login when set to false.
[[GamePot getInstance] setAutoAgree:YES];

// When applying the MATERIAL_ORANGE as custom
GamePotAgreeOption* options = [[GamePotAgreeOption alloc] init:MATERIAL_ORANGE];
[[GamePot getInstance] setAgreeBuilder:options];

...

[[GamePotChannel getInstance] Login:GamePotChannelType viewController:self success:^(GamePotUserInfo* userInfo) {

} cancel:^{

} fail:^(NSError *error) {

} update:^(GamePotAppStatus *appStatus) {

} maintenance:^(GamePotAppStatus *appStatus) {

}];

...

Call Agree to Terms and Conditions manually

Use the following code to manually call Agree to Terms and Conditions.

  • Select theme

    // Basic theme
    [[GamePotAgreeOption alloc] init:BLUE];
    [[GamePotAgreeOption alloc] init:GREEN];
    
    // Improved themes  
    //  [[GamePotAgreeOption alloc] init:MATERIAL_RED];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_BLUE];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_CYAN];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_ORANGE];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_PURPLE];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_DARKBLUE];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_YELLOW];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_GRAPE];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_GRAY];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_GREEN];
    //  [[GamePotAgreeOption alloc] init:MATERIAL_PEACH];
    
  • Call

    GamePotAgreeOption* option = [[GamePotAgreeOption alloc] init:MATERIAL_BLUE];
    [[GamePot getInstance] showAgreeView:self option:option handler:^(GamePotAgreeInfo *result) {
       // [result agree]: true if agreed to all required terms and conditions
       // [result agreePush]: true if checked to agree to receive general ad push, false if not
       // [result agreeNight]: true if checked to agree to receive night ad push, false if not
       // Set agreePush or agreeNight values at once through setPushEnable API after login is complete.
    }];
    

Configure Agree to Terms and Conditions UI directly

Rather than using the theme provided by the SDK, you can use the Agree to Terms and Conditions UI theme you configured directly.

To configure the Agree to Terms and Conditions UI directly and use it, use the following code to configure the theme before calling Agree to Terms and Conditions.

  • Pop-up customizing settings when Agree to Terms and Conditions is called automatically
GamePotAgreeOption* options = [[GamePotAgreeOption alloc] init:MATERIAL_BLUE];

[[GamePot getInstance] setAgreeBuilder:options];
  • Detailed settings
GamePotAgreeOption* option = [[GamePotAgreeOption alloc] init:MATERIAL_BLUE];

[option setHeaderBackGradient:@[@0xFF00050B,@0xFF0F1B21]];
[option setHeaderTitleColor:0xFF042941];
[option setContentBackGradient:@[@0xFF112432,@0xFF112432]];
[option setContentIconColor:0xFF042941];
[option setContentCheckColor:0xFF91adb5];
[option setContentTitleColor:0xFF98b3c6];
[option setContentShowColor:0xFF98b3c6];
[option setFooterBackGradient:@[@0xFF112432,@0xFF112432]];
[option setFooterButtonGradient:@[@0xFF1E3A57,@0xFF57B2E2]];
[option setFooterButtonOutlineColor:0xFF0b171a];
[option setFooterTitleColor:0xFFFFFFD5];

// Change description
[option setAllMessage:@"Agree to all"];
[option setTermMessage:@"Required) Terms and Conditions"];
[option setPrivacyMessage:@"Required) Privacy Policy"];
[option setPushMessage:@"Optional) Agree to receive general push"];
[option setNightPushMessage:@"Optional) Agree to receive night push"];
[option setFooterTitle:@"Start game"];

// Whether to display toast messages upon starting the game (agreed time) after agreeing to receive ad (general/night)
[option setShowToastPushStatus:YES];

// Edit the message for agreeing to receive ad push (general/night)
[option setPushToastMsg:@"Push on"];
[option setNightPushToastMsg:@"Night Push on"];
// Set to @"" if not used
[option setHeaderTitle:@"Agree to Terms and Conditions"];

// Whether to display the button for agreeing to receive general ads
[option setShowPush:YES];

// Whether to display the button for agreeing to receive night ads
[option setShowNightPush:YES];

// Set the link for agreeing to receive general ads. (If it's not used, then do not enter.)
[option setPushDetailURL:@"https://..."];

// Set the link for agreeing to receive night ads. (If it's not used, then do not enter.)
[option setNightPushDetailURL:@"https://..."];


  [[GamePot getInstance] showAgreeView:self option:option handler:^(GamePotAgreeInfo *result) {
       .......
  }];

  • Each variable applies to the area displayed in the following image.
    • AgeView
      gamepot_android_09_ko(1)
    • EmailView
      gamepot_android_09_1_ko
    • AgreeView
      gamepot_android_09_2_ko

GDPR Terms and Conditions checklist feature

Use the following code to import the GDPR Terms and Conditions items activated from the dashboard in the form of a list.

(NSArray*) [[GamePot getInstance] getGDPRCheckedList];

//Each returned parameter applies to the following settings in the dashboard.
gdpr_privacy: Privacy Policy
gdpr_term: Terms and Conditions
gdpr_gdpr: GDPR Terms and Conditions
gdpr_push_normal: consent to receive event push notifications
gdpr_push_night: consent to receive nighttime event push notifications (only applicable in Korea)
gdpr_adapp_custom: consent to see personalized ads (for countries where GDPR is applicable)
gdpr_adapp_nocustom: consent to see non-personalized ads (for countries where GDPR is applicable)

Maintenance and force update feature

You can use the maintenance and force update features. You can enable each feature from the Maintenance & update menu in the dashboard to activate it.

Use the following code to use the maintenance and force update features.

[[GamePotChannel getInstance] Login:GAMECENTER viewController:self
    success:^(GamePotUserInfo* userInfo) {
            // Login completed. Handle this according to the game logic.
    } cancel:^{
            // Login canceled by the user.
    } fail:^(NSError *error) {
            // Login failed. Use [error localizedDescription] to display an error message.
    } update:^(GamePotAppStatus *appStatus) {
        // Force update required. Call the following API to display the pop-up provided by SDK.
        // If you'd like to customize it, then you can customize it while the API is not called.
        [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
         setCloseHandler:^{
            // The showAppStatusPopup API is called when it is necessary to close the app.
            // Handle the shutdown process.
        } setNextHandler:^(NSObject* resultPayload) {
            // When you set the dashboard update as recommended, the "Do it next time" button will appear.
            // It is called when the user selects that button.
            // Handle in the same way as when login is completed, using the resultPayload information.
            // GamePotUserInfo* userInfo = (GamePotUserInfo*)resultPayload;

        }];
    } maintenance:^(GamePotAppStatus *appStatus) {
          // Under maintenance. Call the following API to display the pop-up provided by SDK.
          // If you'd like to customize it, then you can customize it while the API is not called.
        [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
         setCloseHandler:^{
            // TODO: This API is called to close the app that called the showAppStatusPopup API.
            // TODO: Handle the shutdown process.
        }];
    }];

Remote configuration feature

You can import the server parameter values registered in the Game > Remote configuration menu in the dashboard. If you import parameter values and use them in the SDK, then you can edit and control various elements without updating the game.

The imported parameters are loaded at login. You can call them after they have been loaded.

Use the following code to use the remote configuration feature.

#import <GamePot/GamePot.h>

//key: parameter string
NSString *str_value = [[GamePot getInstance] getConfig:(NSString*)key];

//Import all parameters added in the dashboard in JSON format.
NSArray *json_value = [[GamePot getInstance] getConfigs];

Game log transfer feature

You can call game logs and check them in the Game > Player menu in the dashboard.

To use the game log transfer feature, enter reserved words in the following code by referring to the table, and then call the code.

  • Reserved words and code
    Reserved words Required Type Description Maximum length
    GamePotSendLogCharacter.NAME Required String Character name 128
    GamePotSendLogCharacter.LEVEL Optional String Level 128
    GamePotSendLogCharacter.SERVER_ID Optional String Server ID 128
    GamePotSendLogCharacter.PLAYER_ID Optional String Character ID 128
    GamePotSendLogCharacter.USERDATA Optional String ETC 128
    #import <GamePot/GamePotSendLog.h>
    #import <GamePot/GamePotSendLogCharacter.h>
    
    GamePotSendLogCharacter* info = [[GamePotSendLogCharacter alloc] init];
    
    [info put:@"name" forKey:GAMEPOT_NAME];
    [info put:@"playerid" forKey:GAMEPOT_PLAYER_ID];
    [info put:@"serverid" forKey:GAMEPOT_SERVER_ID];
    [info put:@"level" forKey:GAMEPOT_LEVEL];
    [info put:@"userdata" forKey:GAMEPOT_USERDATA];
    
    BOOL result = [GamePotSendLog characterInfo:info];
    
    // Result true: Validation succeeded. The logs are transferred to the GAMEPOT server.
    // Result false: Validation failed. Check the logcat.
    

Check AppStatus

Use the following code to check current AppStatus of the client. (Check maintenance/update status before login)

#import <GamePot/GamePot.h>

[[GamePot getInstance] checkAppStatus:^{
    
    //Login Success

} setFailHandler:^(NSError *error) {

    //Failed

} setUpdateHandler:^(GamePotAppStatus *status) {

    //NeedUpdate
     // Force update required. Call the following API to display the pop-up provided by SDK.
    // If you'd like to customize it, then you can customize it while the API is not called.
    [[GamePot getInstance] showAppStatusPopup:self setAppStatus:status
     setCloseHandler:^{
        // The showAppStatusPopup API is called when it is necessary to close the app.
        // Handle the shutdown process.
    } setNextHandler:^(NSObject* resultPayload) {
        // When you set the dashboard update as recommended, the "Do it next time" button will appear.
        // It is called when the user selects that button.
        // Handle in the same way as when login is completed, using the resultPayload information.
        // GamePotUserInfo* userInfo = (GamePotUserInfo*)resultPayload;

    }];

} setMaintenanceHandler:^(GamePotAppStatus *status) {

    //OnMaintenance
    // Under maintenance. Call the following API to display the pop-up provided by SDK.
      // If you'd like to customize it, then you can customize it while the API is not called.
    [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
     setCloseHandler:^{
        // TODO: This API is called to close the app that called the showAppStatusPopup API.
        // TODO: Handle the shutdown process.
    }];

}];

Set setUserData

Use when you want to add additional information to the member after login.
Maximum number of keys limited to 50
Maximum length of value limited to 1024 bytes
The information can only be viewed in the member details.

#import <GamePot/GamePot.h>

NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
                        @"1.0.23",@"appversion",
                        @"s1",@"server"];
                        
[[GamePot getInstance] setUserData:dict handler:^(BOOL _success, NSError *_error) {
    if(_success)
    {
        // setUserData succeeded
    }
    else
    {
         // setUserData failed
    }
}];

Integrate third party SDK

GAMEPOT iOS SDK supports the linkage with third-party SDKs.

Integrate third party SDK login

To use the login feature by integrating a third-party SDK, enter parameter values in the following code by referring to the table, and then use that code.

  • Parameters and code
    Parameter name Required Type Description
    viewController Required UIViewController Current ViewController
    userid Required NSString Unique user ID
    success Required String Call back upon success
    fail Required String Call back when failed
    update Optional String Call back when the update works
    maintenance Optional String Call back when the check works
    NSString userid = @"memberid of 3rd party sdk";
    
    [[GamePotChannel getInstance] loginByThirdPartySDK:self uId:userid success:^(GamePotUserInfo* userInfo) {
        // Login completed. Handle this according to the game logic.
    } cancel:^{
        // Login canceled by the user.
    } fail:^(NSError *error) {
        // Login failed. Use [error localizedDescription] to display an error message.
    } update:^(GamePotAppStatus *appStatus) {
        // Force update required. Call the following API to display the pop-up provided by SDK.
        // If you'd like to customize it, then you can customize it while the API is not called.
        [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
            setCloseHandler:^{
            // The showAppStatusPopup API is called when it is necessary to close the app.
            // Handle the shutdown process.
        } setNextHandler:^(NSObject* resultPayload) {
            // When you set the dashboard update as recommended, the "Do it next time" button will appear.
            // It is called when the user selects that button.
            // Handle in the same way as when login is completed, using the resultPayload information.
            // GamePotUserInfo* userInfo = (GamePotUserInfo*)resultPayload;
    
        }];
    } maintenance:^(GamePotAppStatus *appStatus) {
        // Under maintenance. Call the following API to display the pop-up provided by SDK.
        // Under maintenance. Call the following API to display the pop-up provided by SDK.
        [[GamePot getInstance] showAppStatusPopup:self setAppStatus:appStatus
            setCloseHandler:^{
            // The showAppStatusPopup API is called when it is necessary to close the app.
            // Handle the shutdown process.
        }];
    }];
    

Integrate third party SDK payment

To use the payment feature by integrating a third-party SDK, enter parameter values in the following code by referring to the table, and then use that code.

  • Parameters and code
    Parameter name Required Type Description
    productid Required NSString Item ID registered in the dashboard
    transactionid Required NSString Payment receipt number (GPA-xxx-xxxx-xxxx)
    currency Optional NSString Currency (KRW, USD)
    price Optional NSDecimalNumber Amount of purchased items
    paymentid Optional NSString Payment store (apple)
    success Optional GamePotCommonSuccess Call back upon success
    fail Optional GamePotCommonFail Call back when failed
    NSString* productId = @"purchase_001";
    NSString* transactionId = @"xxxxxxxxxxx";
    NSString* currency = @"USD";
    NSDecimalNumber* price = [[NSDecimalNumber alloc] initWithString:@"1.09"];
    NSString* paymentId = "apple";
    NSString* uniqueId = "developer unique id";
    
    [[GamePot getInstance] sendPurchaseByThirdPartySDK:productId transactionId:transactionId currency:currency price:price paymentId:paymentId uniqueId:uniqueId success:^{
        // success
    } fail:^(NSError *error) {
        // fail
    }];