react-native ios unrecognized font family "iconfont"的解决办法

在IOS真机上调试出现unrecognized font family “iconfont”的红屏幕问题,查看react-native-vector-icons模块,可以看到已经安装,
这里写图片描述
没有安装的话npm install react-native-vector-icons –save 即可安装,安装结束react-native link react-native-vector-icons 一下。
打开Xcode所在工程,将该模块的fonts文件夹添加到项目文件夹和info.plist同一目录
这里写图片描述
添加结束了结构是这样的:
这里写图片描述
打开info.plist清单文件添加一行Fonts provided by application,格式为数组,将所需字体文件添加到数组的项中,
这里写图片描述
执行
react-native link react-native-vector-icons
react-native start –reset-cache
react-native run-ios查看结果。

猜你喜欢

转载自blog.csdn.net/Ruffaim/article/details/80049291
今日推荐