參考:https://github.com/facebook/FBRetainCycleDetector/issues/115
網(wǎng)上搜索資料找到解決方案:修改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
修改完后執(zhí)行pod install,又出現(xiàn)了新的錯誤:
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
繼續(xù)爬樓搜索看看萬能的網(wǎng)友的終極解決方案...功夫不負有心人,網(wǎng)友的力量是強大的
#指明依賴庫的來源地址
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