我刚刚将React Native集成到现有的iOS应用中。当我进入初始化React Native的屏幕时,如果打包器没有运行,我会得到通常的红色屏幕,上面写着“No bundle URL present”。如果我点击底部的“Reload JS”按钮(或按Cmd + R)两次,我会遇到以下崩溃:
JSCExecutor.cpp:158] Check failed: *m_isDestroyed JSCExecutor::destroy() must be called before its destructor!
我正在使用this之类的代码初始化RN,创建RCTRootView
。
如果打包机正在运行,一切正常。 Cmd + R可以很好地重新加载JS。如果我在JS中出现语法错误并重新加载以获取红色错误屏幕,然后我再次加载它,我会遇到同样的崩溃。
不确定它是否相关,但我也在崩溃消息之前的日志中看到此消息:
WARNING: Logging before InitGoogleLogging() is written to STDERR
崩溃的回溯如下:
#0 0x000000011b7e0d42 in __pthread_kill ()
#1 0x000000011b818457 in pthread_kill ()
#2 0x000000011b57288f in abort ()
#3 0x0000000116ce4079 in google::logging_fail() at .../node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1464
#4 0x0000000116ce406a in google::LogMessage::Fail() at .../node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1478
#5 0x0000000116ce1b6a in google::LogMessage::SendToLog() at .../node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1432
#6 0x0000000116ce2abf in google::LogMessage::Flush() at .../node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1301
#7 0x0000000116ceba78 in google::LogMessageFatal::~LogMessageFatal() at .../node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:2013
#8 0x0000000116ce45b5 in google::LogMessageFatal::~LogMessageFatal() at .../node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:2012
#9 0x0000000116d2ee96 in facebook::react::JSCExecutor::~JSCExecutor() at .../node_modules/react-native/ReactCommon/cxxreact/JSCExecutor.cpp:158
#10 0x0000000116d2f245 in facebook::react::JSCExecutor::~JSCExecutor() at .../node_modules/react-native/ReactCommon/cxxreact/JSCExecutor.cpp:157
#11 0x0000000116d2f269 in facebook::react::JSCExecutor::~JSCExecutor() at .../node_modules/react-native/ReactCommon/cxxreact/JSCExecutor.cpp:157
#12 0x0000000116d4526d in std::__1::default_delete<facebook::react::JSExecutor>::operator()(facebook::react::JSExecutor*) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2537
#13 0x0000000116d45245 in std::__1::unique_ptr<facebook::react::JSExecutor, std::__1::default_delete<facebook::react::JSExecutor> >::reset(facebook::react::JSExecutor*) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2736
#14 0x0000000116d451be in std::__1::unique_ptr<facebook::react::JSExecutor, std::__1::default_delete<facebook::react::JSExecutor> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#15 0x0000000116d451a5 in std::__1::unique_ptr<facebook::react::JSExecutor, std::__1::default_delete<facebook::react::JSExecutor> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#16 0x0000000116d45197 in facebook::react::NativeToJsBridge::~NativeToJsBridge() at .../node_modules/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp:91
#17 0x0000000116d453c5 in facebook::react::NativeToJsBridge::~NativeToJsBridge() at .../node_modules/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp:88
#18 0x0000000116d453e9 in facebook::react::NativeToJsBridge::~NativeToJsBridge() at .../node_modules/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp:88
#19 0x0000000116d3da8e in std::__1::default_delete<facebook::react::NativeToJsBridge>::operator()(facebook::react::NativeToJsBridge*) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2537
#20 0x0000000116d3da69 in std::__1::unique_ptr<facebook::react::NativeToJsBridge, std::__1::default_delete<facebook::react::NativeToJsBridge> >::reset(facebook::react::NativeToJsBridge*) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2736
#21 0x0000000116d3da06 in std::__1::unique_ptr<facebook::react::NativeToJsBridge, std::__1::default_delete<facebook::react::NativeToJsBridge> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#22 0x0000000116d3d9f6 in std::__1::unique_ptr<facebook::react::NativeToJsBridge, std::__1::default_delete<facebook::react::NativeToJsBridge> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#23 0x0000000116d3d9ee in facebook::react::Instance::~Instance() at .../node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:31
#24 0x0000000116d3dad5 in facebook::react::Instance::~Instance() at .../node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:27
#25 0x0000000116b92f21 in std::__1::default_delete<facebook::react::Instance>::operator()(facebook::react::Instance*) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2537
#26 0x0000000116b92efc in std::__1::__shared_ptr_pointer<facebook::react::Instance*, std::__1::default_delete<facebook::react::Instance>, std::__1::allocator<facebook::react::Instance> >::__on_zero_shared() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3780
#27 0x000000011777b43e in std::__1::__shared_weak_count::__release_shared() ()
#28 0x0000000116b9a86c in std::__1::shared_ptr<facebook::react::Instance>::~shared_ptr() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4605
#29 0x0000000116b8b335 in std::__1::shared_ptr<facebook::react::Instance>::~shared_ptr() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4603
#30 0x0000000116b8b27a in ::-[RCTCxxBridge .cxx_destruct]() at .../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:131
#31 0x000000011729d9bc in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#32 0x00000001172a9d34 in objc_destructInstance ()
#33 0x00000001172a9d66 in object_dispose ()
#34 0x0000000116c48b8e in -[RCTBridge dealloc] at .../node_modules/react-native/React/Base/RCTBridge.m:207
#35 0x00000001172b3b8e in objc_object::sidetable_release(bool) ()
#36 0x00000001172b42fa in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
#37 0x00000001185e5ef6 in _CFAutoreleasePoolPop ()
#38 0x0000000118621aec in __CFRunLoopRun ()
#39 0x0000000118621016 in CFRunLoopRunSpecific ()
#40 0x000000011d46ea24 in GSEventRunModal ()
#41 0x000000011303b0d4 in UIApplicationMain ()
#42 0x0000000110d78800 in main at .../main.m:24
#43 0x000000011b4ca65d in start ()
Xcode:8.3.2
模拟器:iPhone 7 - iOS 10.3
React Native:0.47.1
答案 0 :(得分:0)