nsnull的坑

NSString *i = @"" ;
if ([self isKindOfClass:[IG_MallEnterController class]])
{
if ([paraString isMemberOfClass:[NSNull class]])
{
i = @"0";
//只要前面有null 错误就不会执行后面的语句
}
else if ([paraString isEqualToString:@"index=1"])
{
i = @"1";
}
else if ([paraString isEqualToString:@"index=2"])
{
i = @"2";
}

        [((AppDelegate *)[[UIApplication sharedApplication] delegate])showFoundview:i];
        //通知 去跳转
        [[NSNotificationCenter defaultCenter] postNotificationName:DIGOtoFound object:nil userInfo:@{@"path":i}];
    }

下面的写法 是错的
if ([paraString isMemberOfClass:[NSNull class]])
{
i = @"0";
//只要前面有null 错误就不会执行后面的语句
}
if ([paraString isEqualToString:@"index=1"])
{
i = @"1";
}
if ([paraString isEqualToString:@"index=2"])
{
i = @"2";
}

        [((AppDelegate *)[[UIApplication sharedApplication] delegate])showFoundview:i];
        //通知 去跳转
        [[NSNotificationCenter defaultCenter]

报错

-[NSNull isEqualToString:]: unrecognized selector sent to instance 0x1a0426ea8

你可能感兴趣的:(nsnull的坑)