JsonKit Objective-C's isa is deprecated错误

项目中用到了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
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容