Reputation: 1253
I've been working on a project implementing Hola CDN framework. I'm now running into an issue that I can't pass on current date to the parameter programDay and I traced the source code and I found the below line. What does this below line mean?
self.programDay = ![dict[GETPROGRAMLISTDATA_PROGRAMEDAY] isEqual:[NSNull null]] ? dict[GETPROGRAMLISTDATA_PROGRAMEDAY] : nil;
Upvotes: 0
Views: 40
Reputation: 6379
What's NSNull
[NSNull null]
doesn't equal to nil
. It means empty value. For example,
@[[NSNull null]].count
equals to 1. NSNull
is used as placeholder in NSArray
and NSDictionary
. It means nil.
For your question
This line is used to replace NSNull
with nil.
Upvotes: 2
Reputation: 2283
self.programDay = ![dict[GETPROGRAMLISTDATA_PROGRAMEDAY] isEqual:[NSNull null]] ? dict[GETPROGRAMLISTDATA_PROGRAMEDAY] : nil;
This line means that if [dict[GETPROGRAMLISTDATA_PROGRAMEDAY]
has empty value or null value the nil would be assign to self.programDay
as there would be value of [dict[GETPROGRAMLISTDATA_PROGRAMEDAY]
will be assign to self.programDay
. Usually (null) value is return from webservice if that value is not presented in database on server.
Upvotes: 1