Chuyển tới nội dung chính

Cho dự án Native Objective-C

Bước 1: Nhập vào DzoSDK Kit Framework

Copy "dzoconfig.json" to Project Resource

Cấu hình cho DZOGAME

    "buildTarget": "DZOGAME",
"useMultiLanguage": 0,
"defaultLanguageID": "VI",

Điều chỉnh vị trí của icon Age18+ và icon Dzo trên màn hình:

Vị trí mặc định:

    "posision_default":[{
"buttonDzoHome":"",
"tag18Plus":"",
}]

Tùy chỉnh vị trí với 8 điểm neo:

  • topLeft, topCenter, topRight
  • centerLeft, centerRight
  • bottomLeft, bottomCenter, bottomRight

Ví dụ:

    "posision_default":[{
"buttonDzoHome":"centerRight",
"tag18Plus":"topLeft",
}]

Tùy chỉnh màu sắc cho hộp thoại xác nhận mua hàng

Ví dụ:

    "layout_dialog":[{
"color_title":"#000000",
"color_button_buy":"#FFFFFF",
"color_button_cancel":"#000000",
}]

Sao chép "GoogleService-Info.plist" đến Dự án

Sao chép tập tin translations.json đến dự án cho hàm Multi-Language

Bước 2: Cấu hình Signing & Capabilites Xcode Targets / Project IOS Click + Capability

  • Thêm Background modes

  • Tích vào Remote notifications

  • Thêm Sign in with Apple

  • Thêm Push Notification

Kết quả cấu hình sẽ giống như hình này:

Build Setting

Thiết lập Build Settings -> Apple Clang - Language – Objective-C -> Weak References in Manual Retain Release to YES.

Bước 3: Cấu hình Appdelegate AppDelegate Objective-C - Init Connect SDK

  • Thiết lập môi trường (Real/Test)

  • Thiết lập Debug mode (loại bỏ nó khi release)

  • Khởi tạo kết nối trên didFinishLaunchingWithOptions

Nhập vào header trên AppDelegate

    #import <DzoSDK_Kit/DZOSDKCoreKit.h>
#import <DzoSDK_Kit/UserInfo.h>

// SDK DZO application instance
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[DZOSDKCoreKit sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}

// SDK DZO openURL sourceApplication
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSLog(@"TAG openURL");
[[DZOSDKCoreKit sharedInstance] application:application openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}


// SDK DZO openURL Referistall
#pragma mark DZOSDK FB Login, Google Login
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
NSLog(@"TAG openURL options");
[[DZOSDKCoreKit sharedInstance] application:application openURL:url options:options];
NSLog(@"TAG openURL");
return YES;
}

// SDK DZO Pushnotification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"TAG didReceiveRemoteNotification");
[[DZOSDKCoreKit sharedInstance] application:application didReceiveRemoteNotification:userInfo
fetchCompletionHandler:completionHandler ];
}

// SDK DZO didRegisterForRemoteNotificationsWithDeviceToken
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSLog(@"TAG didRegisterForRemoteNotificationsWithDeviceToken");
[[DZOSDKCoreKit sharedInstance] application:application
didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

// SDK DZO userNotificationCenter
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
NSLog(@"TAG userNotificationCenter willPresentNotification");
[[DZOSDKCoreKit sharedInstance] userNotificationCenter:center
willPresentNotification:notification
withCompletionHandler:completionHandler];
}


// SDK DZO userNotificationCenter
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void(^)(void))completionHandler
{
NSLog(@"TAG userNotificationCenter didReceiveNotificationResponse");
[[DZOSDKCoreKit sharedInstance] userNotificationCenter:center
didReceiveNotificationResponse:response
withCompletionHandler:completionHandler];
}

// SDK DZO application continueUserActivity
- (BOOL) application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler
{
NSLog(@"TAG continueUserActivity");
[[DZOSDKCoreKit sharedInstance] application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];

}

// SDK DZO applicationDidBecomeActive for Appflyer
- (void)applicationDidBecomeActive:(UIApplication *)application {
{
//Appflyer Config
[[DZOSDKCoreKit sharedInstance] applicationDidBecomeActive:application];
}

//Ver 2.19
#pragma mark DZOSDK Share detection
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[[DZOSDKCoreKit sharedInstance] applicationDidFinishLaunching:application];

}