欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

iOS端mPaaS离线包10.1.60基线获取启动参数失败白屏问题研究(2)_flushMessageQueue方法查看

程序员文章站 2022-03-11 18:53:16
这是PSDJsBridge里的一个方法下面是伪代码void -[PSDJsBridge _flushMessageQueue](void * self, void * _cmd) { r15 = self; if ([self isBridgeReady] == 0x0) { [r15 setIsBridgeReady:0x1]; } objc_initWeak(&var_30, r15); rbx = [_PSDCon......

 

这是PSDJsBridge里的一个方法

下面是伪代码

void -[PSDJsBridge _flushMessageQueue](void * self, void * _cmd) {
    r15 = self;
    if ([self isBridgeReady] == 0x0) {
            [r15 setIsBridgeReady:0x1];
    }
    objc_initWeak(&var_30, r15);
    rbx = [_PSDConfigurationGet() retain];
    r14 = [rbx shouldCallJSAPIWithToken];
    [rbx release];
    if (r14 != 0x0) {
            var_38 = [[r15 contentView] retain];
            r13 = [_PSGetTokenWithContentView() retain];
            rbx = 0x1;
    }
    else {
            r13 = @"";
            rbx = 0x0;
    }
    r12 = [[NSString stringWithFormat:@"AlipayJSBridge._fetchQueue('%@');", r13] retain];
    if (rbx != 0x0) {
            [r13 release];
            [var_38 release];
    }
    rax = objc_loadWeakRetained(&r15->_contentView);
    *(&var_48 + 0xffffffffffffffe0) = __NSConcreteStackBlock;
    *(&var_48 + 0xffffffffffffffe8) = 0xc2000000;
    *(&var_48 + 0xfffffffffffffff0) = ___33-[PSDJsBridge _flushMessageQueue]_block_invoke;
    *(&var_48 + 0xfffffffffffffff8) = ___block_descriptor_tmp.290;
    *(int8_t *)(&var_48 + 0x8) = r14;
    objc_copyWeak(&var_48, &var_30);
    [rax evaluateJavaScript:r12 completionHandler:&var_68];
    [rax release];
    objc_destroyWeak(&var_48);
    [r12 release];
    objc_destroyWeak(&var_30);
    return;
}
int ___33-[PSDJsBridge _flushMessageQueue]_block_invoke(int arg0, int arg1, int arg2) {
    rdx = arg2;
    r12 = arg0;
    rbx = [arg1 retain];
    var_58 = [rdx retain];
    var_60 = rbx;
    rbx = [[rbx description] retain];
    rdi = @"";
    if (rbx != 0x0) {
            rdi = rbx;
    }
    r14 = [rdi retain];
    [rbx release];
    var_48 = r14;
    if ((*(int8_t *)(r12 + 0x28) != 0x0) && ([r14 length] == 0x0)) {
            r13 = [[PSDLogger shareInstance] retain];
            var_40 = @"logStr";
            r14 = [[NSString stringWithFormat:@"msg=%@"] retain];
            var_38 = r14;
            rbx = [[NSDictionary dictionaryWithObjects:@"msg=%@" forKeys:&var_40 count:0x1] retain];
            [r13 doLogWithLogId:@"PSD_JsApi_Call_Without_Token" params:rbx];
            [rbx release];
            [r14 release];
            [r13 release];
    }
    r12 = r12 + 0x20;
    r15 = objc_loadWeakRetained(r12);
    rbx = [[r15 contentView] retain];
    rdx = [WKWebView class];
    r13 = [rbx isKindOfClass:rdx];
    [rbx release];
    [r15 release];
    if (r13 != 0x0) {
            r15 = objc_loadWeakRetained(r12);
            rbx = [[r15 contentView] retain];
            var_50 = rbx;
            [r15 release];
            r15 = objc_loadWeakRetained(r12);
            r12 = [[rbx URL] retain];
            rbx = [[r12 absoluteString] retain];
            rsi = @selector(_doFlushMessageQueue:url:);
            r13 = var_48;
            rdx = r13;
            rcx = rbx;
            _objc_msgSend(r15, rsi);
            [rbx release];
            [r12 release];
            [r15 release];
            [var_50 release];
    }
    else {
            r15 = objc_loadWeakRetained(r12);
            rax = [r15 contentView];
            rax = [rax retain];
            *(&var_68 + 0xffffffffffffffd8) = __NSConcreteStackBlock;
            *(&var_68 + 0xffffffffffffffe0) = 0xc2000000;
            *(&var_68 + 0xffffffffffffffe8) = ___33-[PSDJsBridge _flushMessageQueue]_block_invoke_2;
            *(&var_68 + 0xfffffffffffffff0) = ___block_descriptor_tmp.287;
            objc_copyWeak(&var_68, r12);
            *(&var_68 + 0xfffffffffffffff8) = [var_48 retain];
            rsi = @selector(evaluateJavaScript:completionHandler:);
            rdx = @"document.location.href";
            rcx = &var_90;
            _objc_msgSend(rax, rsi);
            [rax release];
            [r15 release];
            [var_70 release];
            objc_destroyWeak(&var_68);
            r13 = var_48;
    }
    [r13 release];
    [var_58 release];
    [var_60 release];
    rax = *___stack_chk_guard;
    if (rax != *___stack_chk_guard) {
            rax = __stack_chk_fail();
    }
    return rax;
}
int ___33-[PSDJsBridge _flushMessageQueue]_block_invoke_2(int arg0, int arg1) {
    r14 = [arg1 retain];
    r15 = objc_loadWeakRetained(arg0 + 0x28);
    rbx = [[r14 description] retain];
    [r14 release];
    [r15 _doFlushMessageQueue:*(arg0 + 0x20) url:rbx];
    [rbx release];
    rax = [r15 release];
    return rax;
}

 

然后对这个代码还原一下可以运行的代码(不保证完全正确)

需要引入PSDUtils.h头文件

-(void)_flushMessageQueueS{
    if ([self isBridgeReady] == 0x0) {
            [self setIsBridgeReady:0x1];
       }
    BOOL r14 = [[PSDConfiguration defaultConfiguration]  shouldCallJSAPIWithToken];
    
    BOOL rbx;
    NSString *r13;
    if (r14 != 0x0) {
        
        r13 = PSGetTokenWithContentView([self contentView]);
        rbx = 1;
    }else{
        r13 = @"";
        rbx = 0x0;
    }
    
    NSString *r12 = [NSString stringWithFormat:@"AlipayJSBridge._fetchQueue('%@');", r13];
                      
                   
    [self.contentView evaluateJavaScript:r12 completionHandler:^(NSString* str, NSError * _Nullable error) {
      NSString * rbx =  [str description];
      NSString*  rdi = @"";
         if (rbx != 0x0) {
                 rdi = rbx;
         }
        
        if ([self.contentView isKindOfClass:[WKWebView class]]) {

            NSURL* r12 = [[self contentView] URL];
            NSString* rbx3 = [r12 absoluteString];
            [self _doFlushMessageQueue:rbx url:rbx3];

            
        }else{
             WKWebView* rax = [self contentView];
            [rax evaluateJavaScript:@"document.location.href" completionHandler:^(NSString* strr, NSError * _Nullable error) {
                
                NSString* rbx2 = [strr description];
                
                  [self _doFlushMessageQueue:rbx url:rbx2];
                
            }];
        }
        
    }];
    
//    [self _flushMessageQueueS];
}

 

本想这里可以看看白屏问题,可是只是原生调用了h5,执行了一下交互代码,这个思路也暂停一下。

 

 

 

 

本文地址:https://blog.csdn.net/qq_15509071/article/details/107977368