close

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

Hello Guys, How are you all? Hope You all Are Fine. Today When I updated Xcode to 12.5 and iOS to 14.5 I can’t run the iOS app on a real device nor in the simulator. in React Native. So Here I am Explain to you all the possible solutions here.

Without Wasting your time, Lets start React Native 0.64 won’t build iOS app after updating Xcode to 12.5 and iOS to 14.5 Article to Solve This Error.

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

Today When I updated Xcode to 12.5 and iOS to 14.5 I can’t run the iOS app on a real device nor in the simulator. Actually When I run npm run ios, I get this message:

The following build commands failed:
        CompileC .../Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/DistributedMutex.o /Users/guilherme/Documents/Dood/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

I Also cant run it from XCode.

How To Solve React Native 0.64 won’t build iOS app after updating Xcode to 12.5 and iOS to 14.5 Error ?

Question: How To Solve React Native 0.64 won’t build iOS app after updating Xcode to 12.5 and iOS to 14.5 Error ?
Answer: Step 1: First Of all Open your Podfile in your React Native project. Step 2: Add this to your post_install in your Podfile. Step 3: Now add find_and_replace this below function in your Podfile. You can put this function anywhere in the podfile. Step 4: Run pod install. Step 5: Your Error should Gone now.

Solution 1

Step 1: First Of all Open your Podfile in your React Native project.

Step 2: 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

Step 3: Now add find_and_replace this below function in your Podfile. 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

Step 4: Run pod install

Step 5: Your Error should Gone now.

Solution 2

When I commenting out Flipper in the Podfilepod install, and rebuild worked as a temp solution.

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!
  # post_install do |installer|
  #   flipper_post_install(installer)
  # end

Solution 3

If you get an error relating to permissions while accessing the DistributedMutex-inl.h file Then Just delete your /pods folder and run pod install again.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment