How can I test an NSString for being nil?

前端 未结 8 1829
借酒劲吻你
借酒劲吻你 2020-12-09 07:12

Can I simply use

if(myString == nil)

For some reason a string that I know is null, is failing this statement.

8条回答
  •  清歌不尽
    2020-12-09 07:26

    Is it possible that your string is not in fact nil, and is instead just an empty string? You could try testing whether [myString length] == 0.

提交回复
热议问题