如何测试 NSString 是否为零? [英] How can I test an NSString for being nil?

查看:28
本文介绍了如何测试 NSString 是否为零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以简单地使用吗

if(myString == nil)

由于某种原因,一个我知道为空的字符串未能通过该语句.

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

推荐答案

我在调试器中的字符串似乎报告为 (null) 但这是由于它的分配方式,我修复了它,现在它正在报告作为零.这解决了我的问题.

It seems that my string in the debugger was reporting as (null) but that was due to how it was being assigned, I fixed it and now it is reporting as nil. This fixed my issue.

谢谢!

这篇关于如何测试 NSString 是否为零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆