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

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

问题描述

我可以简单地使用

if(myString == nil)

由于某种原因,我知道的字符串为空,这个语句失败。

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

推荐答案

似乎调试器中的字符串报告为(null),但这是由于它是如何分配的,我修复了它,现在报告为nil。这解决了我的问题。

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天全站免登陆