allez
2024-04-01 c1fba96d94b6f080a3b866260b9bb2be3b722400
0312 iossdk初始化成功的通知要等待游戏代码加载后
1个文件已修改
38 ■■■■ 已修改文件
Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm
@@ -29,6 +29,8 @@
static NSString* sUserName;
static NSThread* _thread;
static NSString* channel;
static bool isOPSdkInitOK = false; //渠道sdk是否初始化成功
static bool isGameInitOK = false; //游戏的代码模块是否加载,sdk在热更部分,未加载会导致初始化失败
-(id)init
{
@@ -46,6 +48,11 @@
-(void) Init
{
    isGameInitOK = true;
    if (isOPSdkInitOK)
    {
        [self SendToGameSdkInitOK];
    }
    UIDevice *_device = [UIDevice currentDevice];
    _device.batteryMonitoringEnabled = true;
    
@@ -219,19 +226,10 @@
    // ------------------------------------------------------
}
- (void)smpcQpInitResult:(NSNotification *)notify {
    NSLog(@"init result:%@",notify);
    NSDictionary *userInfo = notify.userInfo;
    int errorCode = [userInfo[kSmpcQuickSDKKeyError] intValue];
    switch (errorCode) {
        case SMPC_QUICK_SDK_ERROR_NONE:
- (void) SendToGameSdkInitOK
        {
            NSLog(@"初始化成功");
//            NSString *_appid = [[SMPCQuickSDK defaultInstance] getConfigValue:@"zfappid"];
//            if (_appid == nil || [_appid isEqualToString:@""])
//            {
//                _appid = sAppID;
//            }
            NSString *_appid = sAppID;
            NSLog(@"init _appid:%@",_appid);
            
@@ -241,6 +239,24 @@
                                          _appid, @"yj_appid", _appid, @"yj_spid", nil];
            [self SendMessageToUnity:_dict];
        }
- (void)smpcQpInitResult:(NSNotification *)notify {
    NSLog(@"init result:%@",notify);
    NSDictionary *userInfo = notify.userInfo;
    int errorCode = [userInfo[kSmpcQuickSDKKeyError] intValue];
    switch (errorCode) {
        case SMPC_QUICK_SDK_ERROR_NONE:
        {
            isOPSdkInitOK = true;
            if (isGameInitOK)
            {
                [self SendToGameSdkInitOK];
            }
            else
            {
                NSLog(@"渠道sdk初始化成功,等待游戏加载后通知");
            }
        }
            break;
        case SMPC_QUICK_SDK_ERROR_INIT_FAILED:
        default: