解决方案:https://www.npmjs.com/package/react-native-launch-image
以上一通操作之后编译,仍会报错 RCTBridgeModule.h file not found
![](https://img.haomeiwen.com/i4945909/eabbbb24084c6b5a.png)
解决方法:
1.Build Setting->Header Search Paths
添加link :$(SRCROOT)/../node_modules/react-native/React
2. 将#import"RCTBridgeModule.h"替换为#import <React/RCTBridgeModule.h>
3.重新编译即可。
小插曲:
import * as launchImage from 'react-native-launch-image';
class App extends React.Component {
async componentDidMount(){
launchImage.hide();//勿删这句代码,会导致安卓正常运行,iOS一直保持在启动页,连摇一摇调试菜单都出不来,还以为是iOS突然抽风,各种百度无果,最后检查一下代码发现这句丢了。
}
}
附:
React Native开发错误警告处理总结(已解决 !持续更新)
Notice:You should not keep launch image more than 5 seconds, which may cause your app got killed by iOS. To do long-time work(like httprequest, which may fail or tooks long), you should first render a reactnative page, then hide launch image before work, or set a timeout, hidelaunch image even if request is still waiting.
网友评论