美文网首页
JsonKit Objective-C's isa is de

JsonKit Objective-C's isa is de

作者: zgsddzwj | 来源:发表于2019-08-27 10:36 被阅读0次

项目中用到了JsonKit解析器,但是每次运行都会报一堆错误。

Assignment to Objective-C's isa is deprecated in favor of object_setClass() 
Direct access to Objective-C's isa is deprecated in favor of object_getClass()

这时,我们需要将Build Settings中的CLANG_WARN_DIRECT_OBJC_ISA_USAGE设置为NO。手动修改它实在不是明智之举,因为你修改了Podfile,重新执行$ pod install后,JSONKit target的设置又被还原了。解决方案如下:

在Podfile最后,添加一个post_install hook,由它来帮我们修改

CLANG_WARN_DIRECT_OBJC_ISA_USAGE
post_install do |installer_representation|
  installer_representation.pods_project.targets.each do |target|
    if target.name == 'JSONKit'
      target.build_configurations.each do |config|
          config.build_settings['CLANG_WARN_DIRECT_OBJC_ISA_USAGE'] = 'NO'
      end
    end
  end
end

相关文章

网友评论

      本文标题:JsonKit Objective-C's isa is de

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