iOS 查漏报错 模拟器崩溃indirect_symbol_bindings[i] = cur->rebinding FBRetainCycleDetector iOS15 fishhook c...

pod 'MLeaksFinder', :configurations => ['Debug']
  post_install do |installer|
      ## Fix for XCode 12.5
      find_and_replace("Pods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm",
        "layoutCache[currentClass] = ivars;", "layoutCache[(id<NSCopying>)currentClass] = ivars;")
      ## Fix for XCode 13.0
        find_and_replace("Pods/FBRetainCycleDetector/fishhook/fishhook.c",
        "indirect_symbol_bindings[i] = cur->rebindings[j].replacement;", "if (i < (sizeof(indirect_symbol_bindings) / sizeof(indirect_symbol_bindings[0]))) { \n indirect_symbol_bindings[i]=cur->rebindings[j].replacement; \n }")
  end

push end of the file:

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

pod install 遇到终端报错:
[!] An error occurred while processing the post-install hook of the Podfile.
Permission denied @ rb_sysopen - Pods/FBRetainCycleDetector/fishhook/fishhook.c

  1. 可以先不添加def find_and_replace(dir, findstr, replacestr)的替换,手动去 Pods/FBRetainCycleDetector/fishhook/fishhook.c文件中替换内容indirect_symbol_bindings[i] = cur->rebindings[j].replacement;if (i < (sizeof(indirect_symbol_bindings) / sizeof(indirect_symbol_bindings[0]))) { indirect_symbol_bindings[i]=cur->rebindings[j].replacement; }
  2. 也可以在Pods/FBRetainCycleDetector/fishhook/fishhook.c文件中随意修改点内容获取修改pods文件的权限。 然后添加上def find_and_replace(dir, findstr, replacestr)的替换 再去pod install

JCLeaksFinder 查漏方式: https://github.com/JerryChu/JCLeaksFinder

pod 'FBRetainCycleDetector', :configurations => ['Debug']
pod 'JCLeaksFinder', :configurations => ['Debug']

MLeaksFinder查漏方式:

pod 'FBRetainCycleDetector', :configurations => ['Debug']
pod 'MLeaksFinder', :configurations => ['Debug']
不报错的库

pod 'MLeaksFinder', :git => "https://github.com/Tencent/MLeaksFinder.git"

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容