iOS controller pop 后 app 崩溃

Open
#421 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
ios, javascript, objective-c
Domain
mobile-dev

Research direction

Start with HMJSCExecutor.m around line 1315 and reproduce the reported sequence: a native UITabBarController managing multiple HMViewControllers loads JavaScript resources, then the tab-bar controller is popped. Check the crash around the logged HMJSContext destruction and verify that the component is destroyed normally without a crash.

Written by the indexing model from the issue text.

Description

bug Needs: Triage 🔍

描述

iOS controller pop 后 app 崩溃

Hummer version:

master branch

复现步骤

  1. 导出 tabbar 视图组件
    2.组件中使用原生 UITabBarController
    3.UITabBarController 管理多个 HMViewController
    4.HMViewController 加载 js 资源
    5.tabbar 所在控制器 pop 后 控制台输出 ‘HMJSContext 销毁’
    6.执行到 HMJSCExecutor.m 1315行 后崩溃

预期结果

组件正常销毁

样例代码、屏幕截图或者仓库链接

js 使用:

let tabBar = new TabBar()
tabBar.items = [{},{}]
this.appendChild(tabBar)

tabbar 视图组件关键代码:

HMJSContext *context = [HMJSGlobal.globalObject currentContext:self.hmContext];

NSURL *url = [NSURL URLWithString:urlString];
if (url.scheme.length == 0) {
    if (context) {
        url = [[NSURL alloc] initWithString:urlString relativeToURL:context.url];
        if (url.scheme.length == 0) {
            return;
        }
    } else {
        return;
    }
}

HMViewController *controller = [[HMViewController alloc] initWithURL:url.absoluteString params:@{}];
[self setTabBarItemImage:controller.tabBarItem imageSrc:imageSrc isSelectedImage:NO];
[self setTabBarItemImage:controller.tabBarItem imageSrc:selectedImageSrc isSelectedImage:YES];

崩溃的代码位置
image

Dominant language
Objective-C
Stars
1.4k
Forks
186
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from didi/Hummer

All issues in didi/Hummer

Similar issues

More Objective-C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.