React Native 0.64 won’t build iOS app after updating Xcode to 12.5 and iOS to 14.5

There’s a solution I found here.

Add this to your post_install in your Podfile:

post_install do |installer|
  flipper_post_install(installer)

  ## Fix for Flipper-Folly on iOS 14.5
  find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_notify_one(state)", "folly::atomic_notify_one(state)")

  find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")
end

You’ll also need to add the function def for this find_and_replace function (you can put this function anywhere in the podfile):

def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

Run pod install again and it should work. If you get an error relating to permissions while accessing the DistributedMutex-inl.h file, delete your /pods folder and run pod install again

You should see text print out that says Fix: Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h, etc. If you don’t, double check the path in the find_and_replace call.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)