harmony 鸿蒙Compiler and Runtime
Compiler and Runtime
What if a crash occurs when I obtain a string in JSON format from rawfile, convert the string into an object, and call the instance method?
Applicable to: OpenHarmony 3.2 Beta (API version 9)
Symptom
“jscrash happened in xxxxxxxxx” is displayed, and the crash log contains “Error message: Unexpected Object in JSON”.
Solution
The prototype of the object obtained by parsing the string in JSON format is object. The prototype chain does not contain the instance method. Therefore, the object cannot be called.
To solve this problem, use either of the following methods: 1. Add the prototype to the parsed object. 2. Change the instance method to a static method and call it through the class name.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Using NDK in a CMake Project
harmony 鸿蒙Application Access Control Development
harmony 鸿蒙Application Model Development
harmony 鸿蒙ArkUI Animation/Interaction Event Development (ArkTS)
harmony 鸿蒙ArkUI Component Development (ArkTS)
harmony 鸿蒙ArkUI Development (JS)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦