Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8276323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:20:28+00:00 2026-06-08T08:20:28+00:00

I am calling a web service in my project, for handling web service result

  • 0

I am calling a web service in my project, for handling web service result there is a method, which tells what is returned by service. Other methods use this value for further process.

network problem, webserivce problem or any xyz reason, webserivce handling method return (null) value.

Now I have to perform nul checks, two approaches worked for me

if([val isEqualToString:@"(null)"]) ...

if(!val) ...

there are many questions regarding checking null, but not clearing my concepts.
Some says check length if I check the length like val.length it will be 6, because handler method return the “(null)”. And !val I am not clear how this works. Some also says check isKindOfClass [NSNull null] …

Please can any one demystify this null.

Please don’t give comparison of nil vs Nil vs Null …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:20:29+00:00Added an answer on June 8, 2026 at 8:20 am

    if(!val) will test if val is null. That should be what you want to use, plain and simple. if(val == nil) is equivalent.

    [val isEqualToString:@"null"] will, as the name suggests, test if val is equal to the string “null” which would most certainly make it not null.

    [val isKindOfClass:[NSNull class]] has no relevance to you right now, so don’t worry about it.

    Edit since you asked for an explanation of NSNull:

    Sometimes, you need to be able to store the concept of nil rather than nil itself.

    Suppose you wanted an array with nil inside it. You want your array to look like [obj1, obj2, nil, obj3].

    You can’t declare an array like [NSArray arrayWithObjects:obj1, obj2, nil, obj3, nil] because as it goes through the arguments, when it sees nil it’ll stop. This will result in the array [obj1, obj2], which is not what you wanted.

    So what do you do in a situation like this? You make your array [NSArray arrayWithObjects:obj1, obj2, [NSNull null], obj3]. Now you have an object in your array, but this particular object is one that everyone in the system has agreed to call “null.” It’s not actually null.

    What’s really going on here is [NSNull null] is a singleton. When you call [NSNull null], it returns a static instance of NSNull. If you call [NSNull null] again, it’ll return that same object, regardless of where you call the method. Because there is exactly one NSNull instance in the whole entire world of your app, it’s equivalent to null because there will never be an object at that same address that doesn’t have a null meaning.

    So, as I said above, it’s not relevant to you at all. You only need NSNull if you need a legitimate Objective-C object but you want it to be “null.” It’s usually safer to use NSNull than simply a string @"(null)" or something like that because it could be possible to overwrite the value of that string, mess up the string comparison, sometime down the line you might need to store the string @"(null)" in the same data structure as you’re storing the null object, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error when calling a web service method which writes to
I have this project in which i am calling a web service, receiving rates
In sharepoint my web part is calling a web service. This web service does
I have a Web Service project and a WPF project (which serves as a
I have some problem with calling web service from flex. I have service with
My app is calling a web service to retrieve some data, and I want
I'm calling a web service from a console app - all in C# on
I am calling a web service to return XML data for states/provinces of countries.
I'm calling a web service and returning the following data in JSON format: [{OrderNumber:12345,CustomerId:555}]
In a windows mobile application I am calling a web service to retrieve large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.