项目中用到了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
网友评论