views:

4676

answers:

3

Can I simply use

if(myString == nil)

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

+3  A: 

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.

Ben Alpert
A: 

That was my thought at first, but indeed it is reporting to null. See the following screenshot: http://screencast.com/t/6hQzWmPm62

Kyle Hayes
That makes it look like the string is actually "(null)"
dreamlax
Also, you don't have to check against nil in this case. if phoneNumber is nil, [phoneNumber length] will be 0
rpetrich
A: 

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.

Thanks!

Kyle Hayes