对任何崩溃或错误 iOS 做出反应原生白屏
Posted
技术标签:
【中文标题】对任何崩溃或错误 iOS 做出反应原生白屏【英文标题】:React Native White screen with any crash or error iOS 【发布时间】:2019-02-04 12:37:42 【问题描述】:当我尝试在我的 macbook 上启动我的项目时,我最终得到一个白屏,没有任何错误或崩溃。我在另外两台机器上试过,结果一样。我在 XCode 上没有错误消息,也在终端上运行。我在控制台上没有错误消息(当我激活“Debug JS Remotly”时):
我当然曾多次尝试删除“node_modules”和npm install
。该应用程序已经在 macbook(我们的开发人员之一)上运行了几个月,我们拥有完全相同的配置、相同的源代码 (git)。
我还尝试更改入口点并放置一些超基本的东西:
import React, Component from 'react';
import AppRegistry, Text from 'react-native';
export default class BoldAndBeautiful extends Component
render()
return (
<Text style=fontWeight: 'bold'>
I am bold
<Text style=color: 'red'>
and red
</Text>
</Text>
);
但是在这里,当我多次执行 CMD+R 时,应用程序最终会自行启动并带我进入登机,但就好像应用程序已冻结(冻结),我无法单击按钮,也不滚动,也不调用摇动手势弹出窗口(允许激活调试功能的窗口)
我尝试了几个模拟器(iPhone X、iPhone 6s、iPhone 8...)和几个不同的版本(ios 10、iOs 11、iOs 12)
XCode 版本:10.1 节点版本:v8.11.3 我的 package.json:
"@ptomasroos/react-native-multi-slider": "^1.0.0",
"moment": "^2.22.2",
"native-base": "^2.7.2",
"prop-types": "latest",
"proxy-polyfill": "^0.3.0",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-native-animatable": "^1.3.0",
"react-native-background-fetch": "^2.4.3",
"react-native-collapsible": "^0.13.0",
"react-native-device-info": "^0.21.5",
"react-native-elements": "^0.19.1",
"react-native-fast-image": "^5.0.3",
"react-native-flip-toggle-button": "^1.0.5",
"react-native-image-progress": "^1.1.1",
"react-native-image-resizer": "^1.0.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-localization": "^2.0.2",
"react-native-mail": "^3.0.6",
"react-native-material-textfield": "^0.12.0",
"react-native-navigation": "^2.0.2425",
"react-native-offline": "^3.11.0",
"react-native-progress": "^3.5.0",
"react-native-queue": "^1.2.1",
"react-native-secure-key-store": "^2.0.0",
"react-native-shared-group-preferences": "^1.1.15",
"react-native-vector-icons": "^4.6.0",
"react-native-version-check": "^3.0.0-rc.5",
"react-native-wheel-picker": "^1.2.0",
"react-redux": "^5.0.7",
"realm": "^2.17.0",
"redux": "^4.0.0",
"redux-persist": "^5.10.0",
"redux-saga": "^0.16.0",
"redux-thunk": "^2.3.0",
"typescript": "^2.9.2"
提前感谢您的帮助
【问题讨论】:
直接从 Xcode 运行时,它会在 Xcode 的控制台上崩溃或显示任何错误吗? 没有错误(在 xcode 控制台上),无论是在 xcode 上还是通过命令行(react-native run-ios)启动项目时都没有崩溃 【参考方案1】:我刚刚找到了!您所要做的就是使用 Yarn! 我再次使用 Yarn 开始了整个安装,这里是 yarn.lock 的差异:
【讨论】:
以上是关于对任何崩溃或错误 iOS 做出反应原生白屏的主要内容,如果未能解决你的问题,请参考以下文章
如何修复 pod install 错误 glog 太旧或缺少在 Windows 10 中反应原生 ios