ios - Multiple methods named 'integerValue' found with mismatched
迷茫
迷茫 2017-04-17 13:53:57
0
1
616

我加入了下面这个类:

    #import "NSNull+NullCast.h"

@implementation NSNull (NullCast)

- (float)floatValue
{

    return 0.0;

}

- (double)doubleValue
{
    return 0.0;
}

- (int)intValue
{

    return 0;

}  

- (int)integerValue
{
    return 0;
}

在iPhone5s-ios8.1报错如下:

Multiple methods named 'integerValue' found with mismatched result, parameter type or attributes

可是奇怪的是iPhone5-ios8.1却顺利编译通过。

一样的操作系统,难道机型不一样也不行?看报错是ARC报错

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

Antworte allen(1)
伊谢尔伦

能理解你的意思,不过还是把integerValue这个方法去掉吧,不太安全。虽然开放的接口里没有这个方法,但这个类有可能实现了这个私有方法。所以编译的时候还是可能会出问题。现在看貌似intValue暂时没有问题。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!