Nit*_*esh 10 react-native react-native-vector-icons react-native-elements
我是 React-Native 的新手,我已将 react-native-vector-icons 库手动添加到 Xcode 和 Android Studio。如果使用 Xcode 运行代码,它会成功执行而没有任何问题。但是如果我尝试从终端(react-native run-ios)运行代码,它会在模拟器中显示“无法识别的字体系列材料”。但是如果我运行命令(react-native run-android),这个工作也是一样的。
** BUILD FAILED **
The following build commands failed:
CompileC /Users/user/Documents/Test/JobsNProfiles/ios/build/Build/Intermediates.noindex/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/Objects-normal/x86_64/RCTFont+FA5.o /Users/user/Documents/Test/JobsNProfiles/node_modules/react-native-vector-icons/RNVectorIconsManager/RCTFont+FA5.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Run Code Online (Sandbox Code Playgroud)
Sei*_*hin 25
我找到的解决方案是检查字体是否添加到Info.plist文件中的 UIAppFonts 数组中:
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
</array>
Run Code Online (Sandbox Code Playgroud)
欲了解更多信息,请点击此处
小智 6
我不确定您的配置中到底缺少什么,所以我将说明我认为的所有情况:
删除 ios/build 文件夹,然后尝试自动链接:react-native link react-native-vector-icons.
确保您已检查在构建阶段的复制捆绑资源中复制了字体。如果没有,请重新检查手动配置步骤。
确保杀死打包程序并重新运行以使更改生效。
| 归档时间: |
|
| 查看次数: |
7447 次 |
| 最近记录: |