Skip to content

SohaSDK for iOS 1.3.x.x Migration Guide

This guide is provided in order to ease the transition of existing applications using SohaSDK 1.2.x.x to the latest APIs, as well as explain the design and structure of new and updated functionality.

Requirements

  • iOS 13.0
  • Xcode 15.3

Benefits of Upgrading

  • Less code: Up to 30 % less code to write.
  • Less file size: Binary artifact sizes are now smaller.
  • Intuitive: The APIs are intuitive - easy to discover and use.
  • Accelerate development

Namespace Changes

You will notice that previous uses of Soha no longer can be found. In any file you are using the SohaGame iOS SDK please add to the top of the file:

#import <SohaSDK/SohaSDK.h>
PayListModel has been renamed to SohaIAPProductList.

SohaIAPModel has been renamed to SohaIAPProduct.

Updating method calls

Added

A new feature of 1.3.x.x is register the remote push notification and handle the notification center's delegate for you.

[SohaSDK requestPushNotification];

Updated

Initialization

[Soha sohaInitWithGameDelegate:self
            application:[UIApplication sharedApplication]
            launchOptions:launchOptions
            loginManually:YES
            andSetLanguageTo:SohaSDKLanguageVietnam];
[SohaSDK startWithDelegate:self
        application:[UIApplication sharedApplication]
        launchOptions:launchOptions
        loginManually:YES
        language:SohaSDKLanguageVietnamese];

Enable Tracking Pre Alert Screen

[Soha showInAppPopupTracking];
[SohaSDK enableTrackingPreAlertScreen];
[SohaSDK requestTracking];

Info

In version 1.3.0.1, SohaGame SDK will not automatically display popup requesting tracking authorization (for iOS versions 14.5 and above). You need to request tracking authorization manually. The SDK also provides a requestTracking method to present App Tracking Transparency authorization request.

Logout

[Soha sohaLogoutSDK];
[SohaSDK logout];

Delete Account

[Soha deleteAccount];
[SohaSDK deleteAccount];

Change SDK language

[Soha languagueHasChangedTo:SohaSDKLanguageEnglish];
[SohaSDK changeLanguage:SohaSDKLanguageEnglish];

SohaSetting

[SohaSetting sohaSettings];
[SohaSetting settings];

SohaDelegate Protocol

- (void)sohaLoginDelegate:(SohaUser *)user{
}

- (void)sohaLogoutDelegate:(SohaUser *)user{
}

- (void)sohaDeleteAccountDelegate:(SohaUser *)user{
}

- (void)sohaDidPurchaseSuccess:(SohaTransaction *)transaction{
}

- (void)sohaDidPurchaseFailed:(SohaTransaction *)transaction purchaseError:(NSString *)error{
}
- (void)sohaDidLogoutSuccess:(SohaUser *)user{
}

- (void)sohaDidDeleteAccountSuccess:(SohaUser *)user{
}

- (void)sohaDidPurchaseSuccess:(SohaTransaction *)transaction{
}

- (void)sohaDidPurchaseFailed:(SohaTransaction *)transaction purchaseError:(NSString *)error{
}

Push Notification

Register Device Token

[Soha sohaPostDeviceToken:deviceToken];
[SohaSDK registerDeviceToken:deviceToken];

UNUserNotificationCenterDelegate

- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
     [Soha userNotificationCenter:center didReceiveNotificationResponse:response];
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
     [Soha userNotificationCenter:center willPresentNotification:notification];
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
     [SohaSDK didReceiveNotificationResponse:response];
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
     [SohaSDK willPresentNotification:notification];
}

In-App Purchase

Open the SDK's Payment Center

[Soha sohaInAppPhurchase];
[SohaSDK openSDKPurchase];

Log Events

Event logging methods in version 1.3.x.x have changed a lot. Event logging methods now have a more explicit and intuitive syntax.

create_characte event:

[Soha sendEventCreateCharacter];
[SohaSDK logCreateCharacterEventWithRoleName:role_name
                                      roleID:role_id
                                   roleLevel:role_level
                                  serverName:server_name
                                    serverID:server_id];

set_role event:

[Soha sendEventSetRoleName:role_name
                    roleID:role_id
                 roleLevel:role_level
                serverName:server_name
                  serverID:server_id];
[SohaSDK logSetRoleEventWithRoleName:role_name
                              roleID:role_id
                           roleLevel:role_level
                          serverName:server_name
                            serverID:server_id];

complete_tutorial event:

[Soha gameDidCompleteTutorial];
[SohaSDK logCompleteTutorialEvent];

shg_first_purchase event:

[Soha sendGameEventWithName:@"shg_first_purchase" value:nil];
[SohaSDK logGameEventWithEventName:@"shg_first_purchase" value:nil];

Vote app event:

[Soha sendEventWithName:SohaSDKEvent];
[SohaSDK logVoteEvent:SohaSDKVoteEvent];

Custom event:

[Soha sendGameEventWithName:@"<your_event_name>" value:eventData];
[SohaSDK logGameEventWithEventName:@"<your_event_name>" value:eventData];

Removed

sohaLoginDelegate method of SohaDelegate protocol has been removed.

sohaHandleDidBecomeActive has been removed.

sohaHandleDidEnterBackground has been removed.

sohaHandleDidEnterForeground has been removed.

sohaHandleWillTerminate has been removed.