NativeScript / NativeScript/NativeScript

Rendering List View occasionally crashes in iOS == Assertion failed ==

未关闭
#9,117 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
25.7k
派生
1.7k
平均合并
1 天 5 小时
30 天内合并 PR
35

描述

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 7.0.12
  • Cross-platform modules: 7.0.13 (nativescript/core)
  • Android Runtime: 7.0.1
  • iOS Runtime: 7.0.6
  • XCode Version: 12.3
  • Plugin(s): @nativescript/camera 5.0.2, @nativescript/imagepicker 1.0.0, @nativescript/theme 3.0.1, @nstudio/nativescript-cardview 2.0.1, @nstudio/nativescript-pulltorefresh 3.0.1, @nativescript/barcodescanner 4.0.1

Describe the bug

There is a runtime error in iOS when a user navigates back and forth between two pages at least one of which having a list view. Occasionally, when the user navigates back to a page that has a list view, the application crashes and throws the following error.

====== Assertion failed ======
Native stack trace:
1          0x108eca2af tns::Assert(bool, v8::Isolate*) + 119
2          0x108e2b259 tns::ArgConverter::Invoke(v8::Local<v8::Context>, objc_class*, v8::Local<v8::Object>, tns::V8Args&, tns::MethodMeta const*, bool) + 95
3          0x108e8be5a tns::MetadataBuilder::InvokeMethod(v8::Local<v8::Context>, tns::MethodMeta const*, v8::Local<v8::Object>, tns::V8Args&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) + 76
4          0x108e8b773 tns::MetadataBuilder::MethodCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 219
5          0x10901713c v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) + 620
6          0x1090165ec v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) + 556
7          0x109015c73 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 259
8          0x1098aec19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 57
9          0x109847c42 Builtins_InterpreterEntryTrampoline + 194
10         0x109847c42 Builtins_InterpreterEntryTrampoline + 194
11         0x109847c42 Builtins_InterpreterEntryTrampoline + 194
12         0x109847c42 Builtins_InterpreterEntryTrampoline + 194
13         0x109847c42 Builtins_InterpreterEntryTrampoline + 194
14         0x109847c42 Builtins_InterpreterEntryTrampoline + 194
JavaScript stack trace:
at requestLayout (file: node_modules/@nativescript/core/ui/core/view/index.ios.js:37:0)
at <anonymous> (file: node_modules/@nativescript/core/ui/core/properties/index.js:895:0)
at clearInheritedProperties (file: node_modules/@nativescript/core/ui/core/properties/index.js:1144:0)
at _parentChanged (file: node_modules/@nativescript/core/ui/core/view-base/index.js:683:36)
at _removeView (file: node_modules/@nativescript/core/ui/core/view-base/index.js:463:0)
at _removeContainer (file: node_modules/@nativescript/core/ui/list-view/index.ios.js:412:0)
at push.../node_modules/@nativescript/core/ui/list-view/index.js.ListViewCell.willMoveToSuperview (file: node_modules/@nativescript/core/ui/list-view/index.ios.js:39:0)
at match (file: node_modules/@nativescript/core/ui/styling/css-selector/index.js:392:0)
at <anonymous> (file: node_modules/@nativescript/core/ui/styling/css-selector/index.js:376:0)
at match (file: node_modules/@nativescript/core/ui/styling/css-selector/index.js:376:0)

To Reproduce

  1. Open an app that has two pages one of which containing a list view.
  2. Navigate back and forth between the two pages.
  3. Observe when the app crashes once navigated to list view (occasionally).
  4. Read the error in the terminal.

Expected behavior
The application does not crash. At least, it displays a warning.

Sample project

Unfortunately none yet, but I will create a sample project that has this bug if needed.

Additional context

Already asked a question on Stack Overflow a while back.
https://stackoverflow.com/questions/65450002/nativescript-7-app-unexpectedly-crashes-in-ios-assertion-failed

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先重现导航序列,并检查 node_modules/@nativescript/core/ui/core/view/index.ios.js 中的 requestLayout,以及 ui/list-view/index.ios.js 中的 _removeContainer 和 willMoveToSuperview。使用提供的断言和 JavaScript 堆栈跟踪来追踪失败的过渡;当重复导航不再崩溃,或 issue 产生预期的警告时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, javascript
领域
frontend, mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。