安装 react-native-vector 图标后无法构建 React Native 应用程序

时间:2021-02-27 12:03:02

标签: xcode typescript react-native

我最近一直在尝试使用 react-native-vector-icons 在我的项目中添加 react-native 0.63.4。但是,当我构建项目时,当我运行此终端命令 npx react-native run-ios 时,我从终端获得了此信息,错误/警告如下:

In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/json.h:48:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/dynamic.h:796:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/dynamic-inl.h:22:
/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/Conv.h:1266:44: warning: possible misuse of comma operator here [-Wcomma]
      [&](Tgt res) { return void(out = res), src; });
                                           ^
/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/Conv.h:1266:29: note: cast expression to void to silence warning
      [&](Tgt res) { return void(out = res), src; });
                            ^~~~~~~~~~~~~~~
                            static_cast<void>( )
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperClient.cpp:8:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperClient.h:14:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperConnectionImpl.h:12:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperConnection.h:10:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/json.h:48:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/dynamic.h:796:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/dynamic-inl.h:23:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/Format.h:30:
/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/String.h:73:18: warning: '\a' command does not have a valid word argument [-Wdocumentation]
 * \' \" \? \\ \a \b \f \n \r \t \v
               ~~^
/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/String.h:73:21: warning: '\b' command does not have a valid word argument [-Wdocumentation]
 * \' \" \? \\ \a \b \f \n \r \t \v
                  ~~^
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperClient.cpp:8:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperClient.h:16:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperInitConfig.h:10:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/io/async/EventBase.h:46:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/io/async/AsyncTimeout.h:19:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/io/async/EventBaseBackendBase.h:21:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/io/async/EventUtil.h:21:
In file included from /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/Flipper-Folly/folly/portability/Event.h:24:
/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Headers/Public/libevent/event.h:44:10: fatal error: 'event2/event-config.h' file not found
#include <event2/event-config.h>
         ^~~~~~~~~~~~~~~~~~~~~~~

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-Glog' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.4, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-PeerTalk' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'boost-for-react-native' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'GCDWebServer' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target'/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper' from project 'Pods')

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/newuser/Library/Developer/Xcode/DerivedData/numbers-dwsoqoxfvlhqaegkspswqexutfzn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/newuser/workspace/programming/mobile/numbers/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

我进一步尝试用 Xcode 构建,但我从中得到了这个:

/Users/newuser/workspace/libevent/event.h:44:10: 'event2/event-config.h' file not found

我已经尝试了 pod installpod update 仍然无法构建应用程序。

2 个答案:

答案 0 :(得分:1)

我为此链接找到了解决方案:Solution

答案 1 :(得分:0)

我遇到了这个, 您应该解决您的安装常见问题是 infoplist 中没有字体 检查您的信息列表 它需要有

<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>Fontisto.ttf</string>
    <string>Foundation.ttf</string>
    <string>Ionicons.ttf</string>
    <string>MaterialCommunityIcons.ttf</string>
    <string>MaterialIcons.ttf</string>
    <string>Octicons.ttf</string>
    <string>SimpleLineIcons.ttf</string>
    <string>Zocial.ttf</string>
    <string>icomoon.ttf</string>
</array>

如果没有运行

react-native link react-native-vector-icons

另一种解决方案是使用来自

的遗留构建系统
workspace settings -> build system -> legacy build system

还有一件事

<块引用>

如果您使用的是 use_frameworks!在您的 Podfile 中,您需要 通过执行 Icon.loadFont() 动态加载图标字体时 助推您的应用程序。