如果未启用远程调试,则响应本机 ios 应用程序崩溃 [英] react native ios application crash if remote debug is not enabled

查看:40
本文介绍了如果未启用远程调试,则响应本机 ios 应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用本机反应.如果我关闭远程调试 js",应用程序会崩溃并且系统会记录我无法理解的错误.

Using react-native. If i turn off "Debug js Remotely" the app crash and system logs errors that i cannot understand.

我在 ios 模拟器中打开系统日志并记录以下内容

I open system log inside ios simulator and it log following

ivf[95067]: [] nw_connection_get_connected_socket_block_invoke 44 Connection has no connected handler
com.apple.CoreSimulator.SimDevice.73F03ED5-12AF-41DD-9108-349E09982B56.launchd_sim[76806] (UIKitApplication:com.simplein.ivf[0x8918][76828][95067]): Service exited due to Segmentation fault: 11
SpringBoard[76823]: UNSUserNotificationServerConnectionListener connection invalidated
 backboardd[76824]: [Common] Unable to get short BSD proc info for 95067: No such process
backboardd[76824]: [Common] Unable to get proc info for 95067: Undefined error: 0
SpringBoard[76823]: [KeyboardArbiter] HW kbd: Failed to set (null) as keyboard focus
assertiond[76828]: Deleted job with label: UIKitApplication:com.simplein.ivf[0x8918][76828]

我对 ios 开发一无所知,但是一旦我尝试渲染具有 InputText 和其他几个视图的屏幕,应用就会崩溃.

I have no clue in ios developement, but the app crash once i try to render a screen that has an InputText and few other Views.

奇怪的是,如果我远程启用 Debug Js,它会工作得很好,甚至不会记录任何错误.

Strange is if i enable Debug Js Remotely it will work just fine and will not even log any errors.

推荐答案

在这种情况下,问题是 console.log 记录了一个巨大的对象,出于某种原因,这在调试模式下运行时很好,导致调试中的 react-native即使在 ios 上也使用 v8 的 chrome,而在手机上它将使用不同的引擎.

in this case, problem was that console.log was logging a huge objects, for some reason this is fine when running in debug mode cause react-native in debug use v8 of chrome even on ios, while on phone it will use different engine.

因此,建议不要记录具有多重继承的巨大对象(我记录的是一个嵌套组件,该组件具有道具、导航、redux 存储等)在生产中很重要.不要将 console.log 留在代码中以避免此类崩溃.

so as it seems, recommendation for not logging huge objects with multiple inheritance (i was logging this of a nested component which had props, navigation, redux store, etc all attached) is important in production. don't leave your console.log in code to avoid such crashs.

这篇关于如果未启用远程调试,则响应本机 ios 应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆