跳到主要内容

原生Objective-C 项目 (For Native Objective-C Project)

步骤 1: 导入 DzoSDK 工具包 框架 (DzoSDK Kit Framework)

将 "dzoconfig.json" 复制到项目资源中

DZOGAME 配置:

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

调整屏幕上18+ logo与Dzo icon 展示的位置 :

默认位置:

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

使用 8 个锚点自定义位置:

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

示例:

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

自定义充值确认对话框颜色:

示例:

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

将 "GoogleService-Info.plist" 复制到项目中

使用**Multi-Language 功能,**需将 translations.json 文件复制到您的项目中。

步骤 2: 配置签名与Xcode功能 (Config Signing & Capabilites Xcode) 目标/IOS项目

点击 + Capability

  • 添加Background modes, Enter

  • 检查远程通知 (Remote notifications)

  • 添加 Apple 登录

  • 添加推送通知 (Push Notification)

最终配置如下图:

构建配置 (Build Setting)

[将] {.mark} Build Settings Apple Clang - Language -- Objective-C Weak References in Manual Retain Release[ 设置为" ]{.mark}YES"。

步骤 3: 配置 Appdelegate AppDelegate Objective-C -- 初始化连接 SDK

  • 环境配置 (正式/测试)

  • 配置调试模式试图(Debug mode view)(上线时将移除)

  • 在 didFinishLaunchingWithOptions上Init connnect

在 AppDelegate 上导入header

    #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];
}