简体   繁体   English

iOS 7:“ isa”已弃用

[英]iOS 7 : 'isa' is deprecated

I get warning when I run my app in iOS7 "'isa' is deprecated", I don't have any idea how to fix this warning message. 当我在iOS7中运行我的应用程序时,我得到警告“不赞成使用'isa'”,我不知道如何解决此警告消息。 Please any one help on this. 请对此有任何帮助。

array->isa      = _JKArrayClass;

Include <objc/runtime.h> . 包括<objc/runtime.h>

Replace everything like array->isa = _JKArrayClass; 替换所有内容,例如array->isa = _JKArrayClass; with object_setClass(array, _JKArrayClass) object_setClass(array, _JKArrayClass)

And everything like class = array.isa with class = object_getClass(array) class = array.isaclass = object_getClass(array)所有东西

I figured I would share my solution for you Cocoapods users out there. 我想我会为你们的Cocoapods用户分享我的解决方案。 (Please let me know in the comments if you have found a better solution) (如果您找到了更好的解决方案,请在评论中让我知道)

I am using Cocoapods and for this reason I do not want to modify the source code of the libraries I am pulling in. The problem is caused by Cocoapods setting the "Direct usage of 'isa'" value to "Yes (treat as error)", thus causing all automated builds to fail. 我正在使用Cocoapods,因此,我不想修改要导入的库的源代码。问题是由于Cocoapods将“ isa的直接用法”值设置为“是(视为错误,处理)”引起的。 ”,从而导致所有自动构建失败。

I have fixed the problem by adding this to my Podfile: 我通过将其添加到我的Podfile中来解决了这个问题:

post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CLANG_WARN_DIRECT_OBJC_ISA_USAGE'] = 'YES'
        end
    end
end

This way the direct usage of 'isa' will show up as warning but will not cause automated builds to fail. 这样,直接使用“ isa”将显示为警告,但不会导致自动构建失败。

But in arm64 iOS Device build(with Xcode 5.1.0) strangely CLANG_WARN_DIRECT_OBJC_ISA_USAGE = 'YES' option will not properly applied(treat as error). 但是在arm64 iOS设备构建(使用Xcode 5.1.0)中,奇怪的是CLANG_WARN_DIRECT_OBJC_ISA_USAGE ='YES'选项将无法正确应用(视为错误)。 If you need to build, including arm64 just CLANG_WARN_DIRECT_OBJC_ISA_USAGE = 'NO' option can be used. 如果需要构建(包括arm64),则只能使用CLANG_WARN_DIRECT_OBJC_ISA_USAGE ='NO'选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM