美文网首页
nsnull的坑

nsnull的坑

作者: 萧城x | 来源:发表于2015-12-10 11:16 被阅读58次

    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的坑

          本文链接:https://www.haomeiwen.com/subject/wrjehttx.html