skip to Main Content

After upgrading react-native package from 0.63.4 to 0.64.4 I got following errors in Xcode (on MacBook Pro M1) while building and running the app on simulator and device:

enter image description here

I tried to it with and without using flipper, but nothing helped.
Also added CoreFoundation and Foundation Framework manually to the project and ran Xcode with and without Rosetta enabled.

This is my current PodFile:

source 'https://github.com/CocoaPods/Specs.git'

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

platform :ios, '12.0'

target 'MyApp' 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
  )

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"

   # 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)
    end
end

3

Answers


  1. Chosen as BEST ANSWER

    My working solution for this is to create a new, clean project with the version you want to upgrade to. Afterwards do following steps:

    1. Open both .xcworkspace files in Xcode
    2. Head over to your Targets Build Settings
    3. Search for "Header Search Paths"
    4. Copy all Header Search Paths from new Project to your project you want to upgrade
    5. Remove DerivedData, Clean Build and Run again
    6. Run pod install. Maybe you need to upgrade some packages

    Additionally a nice npm script for rebuilding .xcworkspace (Replace "[PRJECT_NAME]" with your .xcworkspace name):

    "renew-pods-m1": "cd ios; rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf [PROJECT_NAME].xcworkspace; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; arch -x86_64 pod install;"
    

    Note: Have a look at your PodFile. Maybe you need to change the use_react_native implementation and add the post_install script

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

    At the end of the PodFile

    # 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)
    end
    

  2. For me it was Flipper. I wasn’t using it in my old project, and it was automatically enabled in my new one. Just comment out the line in your Podfile if your project doesn’t require it.

    # :flipper_configuration => FlipperConfiguration.enabled,
    
    Login or Signup to reply.
    1. Delete folder ios
    2. npm i react-native-eject
    3. react-native eject
    4. Modify ios/Podfile
      enter image description here

    to

     :hermes_enabled => false,
    
    1. Build Project
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search