参考:https://github.com/facebook/FBRetainCycleDetector/issues/115
网上搜索资料找到解决方案:修改podfile文件为:
#指明依赖库的来源地址
source 'https://github.com/CocoaPods/Specs.git'
# 说明平台是ios,版本是10.0
platform :ios, '10.0'
# 忽略引入库的所有警告(强迫症者的福音啊)
inhibit_all_warnings!
target 'TestDemo' do
require "fileutils"
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;")
end
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 'LookinServer', :configurations => ['Debug']
pod 'MLeaksFinder', :configurations => ['Debug']
end
修改完后执行pod install,又出现了新的错误:
Generating Pods project
Fix: Pods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm
[!] An error occurred while processing the post-install hook of the Podfile.
Permission denied @ rb_sysopen - Pods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm
继续爬楼搜索看看万能的网友的终极解决方案...功夫不负有心人,网友的力量是强大的
#指明依赖库的来源地址
source 'https://github.com/CocoaPods/Specs.git'
# 说明平台是ios,版本是10.0
platform :ios, '10.0'
# 忽略引入库的所有警告(强迫症者的福音啊)
inhibit_all_warnings!
target 'TestDemo' do
require "fileutils"
post_install do |installer|
installer.pods_project.targets.each do | target |
installer.pods_project.build_configurations.each do |config|
config.build_settings["SWIFT_VERSION"] = "4.2"
config.build_settings["VALID_ARCHS"] = "arm64 arm64e x86_64"
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "10.0"
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
## Fix for XCode 12.5
find_and_replace("Pods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm",
"layoutCache[currentClass] = ivars;", "layoutCache[(id<NSCopying>)currentClass] = ivars;")
end
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
FileUtils.chmod("+w", name) #add
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 'LookinServer', :configurations => ['Debug']
pod 'MLeaksFinder', :configurations => ['Debug']
end
网友评论