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运行项目
    • 运行成功!
    
    
  • 相关阅读:
    家居有线网络布线方案(转)
    ARP、Tracert、Route 与 NBTStat 命令详解(转)
    集线器、路由器、交换机、第三层交换技术(转)
    C#版nbtstat
    交换机常见故障的一般分类和排障步骤(转)
    Women guojia keneng zai 2015 nian qianhou wancheng di yi ci xiandaihua(拼音化汉字)
    IPv6协议在各操作系统下的安装与配置(转)
    具有字典验证的记事本
    子网掩码计算方法(转)
    最后推荐一篇关于PreEcho的总结论文
  • 原文地址:https://www.cnblogs.com/zhengyan/p/15099636.html
Copyright © 2011-2022 走看看