Home > Software design >  React native build fails for IOS
React native build fails for IOS

Time:11-01

I have been struggling with this build error for the past two days, my project works fine on android, but I can't run it on IOS. I followed the react native documentation for IOS and have installed all the requirements. I'm using Mac OS Catalina, Xcode 12.4.

here is my Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'frontend' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'frontendTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

and this is the error message that I get:

** BUILD FAILED **


The following build commands failed:
        CpResource /Users/alibarznji/Desktop/Projects/grade_application/frontend/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf /Users/alibarznji/Library/Developer/Xcode/DerivedData/frontend-dgqzfuyktcahthepzaqwwqkxxvej/Build/Products/Debug-iphonesimulator/frontend.app/FontAwesome5_Brands.ttf
        CpResource /Users/alibarznji/Desktop/Projects/grade_application/frontend/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf /Users/alibarznji/Library/Developer/Xcode/DerivedData/frontend-dgqzfuyktcahthepzaqwwqkxxvej/Build/Products/Debug-iphonesimulator/frontend.app/FontAwesome5_Regular.ttf
        CpResource /Users/alibarznji/Desktop/Projects/grade_application/frontend/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf /Users/alibarznji/Library/Developer/Xcode/DerivedData/frontend-dgqzfuyktcahthepzaqwwqkxxvej/Build/Products/Debug-iphonesimulator/frontend.app/FontAwesome5_Solid.ttf
        CpResource /Users/alibarznji/Desktop/Projects/grade_application/frontend/src/assets/fonts/regular.ttf /Users/alibarznji/Library/Developer/Xcode/DerivedData/frontend-dgqzfuyktcahthepzaqwwqkxxvej/Build/Products/Debug-iphonesimulator/frontend.app/regular.ttf
(4 failures)

note that I don't use Font-Awesome in my project, and that last line of error which is pointing to my assets/fonts folder with the name of 'regular' does not exist, I have renamed the file to K2D-Regular.ttf and I have run the command 'pod install' and 'pod repo update' afterwards. what am I doing wrong? I appreciate your help in advance, thanks.

CodePudding user response:

From the error, I think you are using react-native-vector icon library for icons, which need some fonts added and those are missing. As per installation guide you have to add fonts specification in your info.plist file like this:

info.plist

<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>
  <string>Fontisto.ttf</string>
</array>
  • Related