美文网首页iOS
在xcode12.5.1上FBClassStrongLayout

在xcode12.5.1上FBClassStrongLayout

作者: song91425 | 来源:发表于2021-09-05 17:26 被阅读0次

    在xcode12.5.1上FBClassStrongLayout 编译时报错

    Cannot initialize a parameter of type 'id<NSCopying> _Nonnull' with an rvalue of type 'Class'

    解决方法(亲测有效):
    在podfile文件最后一行加入下面代码,然后在pod install 一下,重新编译即可。

    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|
          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

    相关文章

      网友评论

        本文标题:在xcode12.5.1上FBClassStrongLayout

        本文链接:https://www.haomeiwen.com/subject/xnfywltx.html