无法识别的字体家庭材料图标



iam对反应的新手,我已经将React-Native-vector-icons库手动添加到Xcode和android Studio中。如果使用XCode成功执行代码,则无需任何问题。但是,如果我试图从终端(反应式run-ios)中运行代码,以显示模拟器中的"未识别字体家庭材料"。但是,如果我运行命令(反应本地运行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)

我发现的解决方案是检查字体是否添加到 info.plist.plist file:

中的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>

有关更多信息在此处

我不确定您在配置中确切缺少什么,所以我将说明所有我相信的情况:

  1. 删除iOS/构建文件夹,然后尝试自动链接: react-native link react-native-vector-icons

  2. 确保您已检查该字体是否在构建阶段的复制捆绑包中复制。如果没有,请重新检查手动配置步骤。

  3. 确保杀死包装器并重新运行以进行更改以生效。

最简单

您可以简单地将以下内容添加到您的Podfile


# Normal
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

# If you are using monorepo
# pod 'RNVectorIcons', :path => '../../../node_modules/react-native-vector-icons'

和运行

yarn podinstall

最新更新