pod 'MLeaksFinder', :configurations => ['Debug'] post_install do |installer| ## Fix for XCode 12.5 find_and_replace("ods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm", "layoutCache[currentClass] = ivars;", "layoutCache[(id<NSCopying>)currentClass] = ivars;") ## Fix for XCode 13.0 find_and_replace("ods/FBRetainCycleDetector/fishhook/fishhook.c", "indirect_symbol_bindings = cur->rebindings[j].replacement;", "if (i < (sizeof(indirect_symbol_bindings) / sizeof(indirect_symbol_bindings[0]))) { \n indirect_symbol_bindings=cur->rebindings[j].replacement; \n }") endpush 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))endpod install 碰到终端报错:
[!] An error occurred while processing the post-install hook of the Podfile.
Permission denied @ rb_sysopen - Pods/FBRetainCycleDetector/fishhook/fishhook.c
- 可以先不添加def find_and_replace(dir, findstr, replacestr)的更换,手动去 Pods/FBRetainCycleDetector/fishhook/fishhook.c文件中更换内容indirect_symbol_bindings = cur->rebindings[j].replacement;为if (i < (sizeof(indirect_symbol_bindings) / sizeof(indirect_symbol_bindings[0]))) { indirect_symbol_bindings=cur->rebindings[j].replacement; }
- 也可以在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" |