項目中用到了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設(shè)置為NO幕随。手動修改它實在不是明智之舉竟趾,因為你修改了Podfile,重新執(zhí)行$ pod install后泼疑,JSONKit target的設(shè)置又被還原了德绿。解決方案如下:
在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