What is the right way to check for a null string in Objective-C?

后端 未结 20 1686
梦毁少年i
梦毁少年i 2020-11-27 09:26

I was using this in my iPhone app

if (title == nil) {
    // do something
}

but it throws some exception, and the console shows that the ti

相关标签:
20条回答
  • 2020-11-27 10:12

    Try this for check null

     if (text == nil)
    
    0 讨论(0)
  • 2020-11-27 10:12
    if ([linkedStr isEqual:(id)[NSNull null]])
                    {
                        _linkedinLbl.text=@"No";
                    }else{
                        _linkedinLbl.text=@"Yes";
                    }
    
    0 讨论(0)
提交回复
热议问题