zoukankan      html  css  js  c++  java
  • react-native xcode DistributedMutex-inl.h 无法启动报错

    解决办法
    临时解决办法(简单粗暴)
    修改/ios/Podfile注释掉Flipper相关的内容。

    # 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

    方法二(推荐)

    修改/ios/Podfile 内容如下:

    详细修改操作:
    注释掉下面内容:

    use_flipper!()

    post_install do |installer|

      react_native_post_install(installer)

    end


    并把此处替换为:

    #⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄修复iOS 14.5新建RN0.64无法运行⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄
    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

    post_install do |installer|
    flipper_post_install(installer)
    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
    #⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃修复iOS 14.5新建RN0.64无法运行⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃

    最终文件如下:

      

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

    platform :ios, '10.0'

    target 'speed2' 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 'speed2Tests' 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)
    #end

    #⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄修复iOS 14.5新建RN0.64无法运行⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄
    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

    post_install do |installer|
    flipper_post_install(installer)
    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
    #⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃修复iOS 14.5新建RN0.64无法运行⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃
    end

    总结

    方法二最终实现思路就是修改这个DistributedMutex-inl.h文件达到修复无法启动的问题。

    修改/ios/Podfile注释掉Flipper相关的内容。

    • 修改/ios/Podfile注释掉Flipper相关的内容。
    • 删除/ios/Pod目录
    • 删除/ios/Podfile.lock
    • 执行 pod install --verbose
    • yarn ios运行项目
    • 运行成功!
    
    
  • 相关阅读:
    windows10下安装zookeeper kafka
    WisDom.Net 框架设计(八) 持久层
    WisDom.Net 框架设计(五) 权限设计
    WisDom.Net 框架设计(二) 服务总线
    业务安全篇-渗透中的表单测试
    【网摘】身在腾讯:浪潮之巅的惶惑与自救
    短链生成
    【读书笔记】——读书之前
    config 设置的两种方式
    ping通但是浏览器打不开网页解决
  • 原文地址:https://www.cnblogs.com/zhengyan/p/15099636.html
Copyright © 2011-2022 走看看