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 4346048
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:07:18+00:00 2026-05-21T12:07:18+00:00

I have a simple isEqualToString test in my application, and for some reason, it

  • 0

I have a simple isEqualToString test in my application, and for some reason, it is always taking the false path of the if statement, even though the console shows that it should be taking the true path.

Here is the code that is in question:

- (void)requestFailed:(ASIHTTPRequest *)request
{   
    NSError *error = [request error];

    NSLog(@"Program requestFailed with error '%@' and reason '%@'", [error localizedDescription], [error localizedFailureReason]);

    NSString *errorMessage = [NSString stringWithFormat:@"%@",[error localizedDescription]];
    if ([[error localizedFailureReason] isEqualToString:@"(null)"])
    {
    }
    else
    {
        errorMessage = [errorMessage stringByAppendingFormat:@"\nReason: %@", [error localizedFailureReason]];
    }

    [Utils msgBox:@"Error with Data Download" message:errorMessage];
}

And in the console:

2011-04-15 14:27:07.341 Program[79087:207] Program requestFailed with error 'The request timed out' and reason '(null)'
2011-04-15 14:27:07.341 Program[79087:207] Displaying a message box with title 'Error with Data Download' and message 'The request timed out
Reason: (null)'

The msgBox method in my Utils class outputs the title and message to the console, which is where the second line comes from.

I have been looking at this for a while, and the answer must be so easy that it escapes notice. Any suggestions? (I tried to trim the white spaces off [error localizedDescription], to no avail.) I am on the latest 4.3 iOS SDK.

  • 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-05-21T12:07:18+00:00Added an answer on May 21, 2026 at 12:07 pm

    The string isn’t equal to “(null)” the string is nil, which when printed to the console is printed AS (null).

    Passing nil to isStringEqual will always return false.

    If you need to check for nil, compare your string to nil, not “(null)”.

    if (error != nil)
    {
        errorMessage = [errorMessage stringByAppendingFormat:@"\nReason: %@", [error localizedFailureReason]];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple code: <?php error_reporting(E_ALL); ini_set('display_errors', true); ini_set('html_errors', false); $test = array(); $test
I have this simple if statement that check UItextfields if empty or not like
I have a very simple isEqualTostring condition inside a button press function using the
My situation is simple: I have some records in my core data store. One
Hello i have a very simple question, I have initialized some variables and started
I have simple CCAnimation loading from playlist, and when i test it on emulator
I have simple static lib in xcode with the only class test.h: @interface TestClass
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have simple class with width and height member fields which define number of
I have simple php validation form that is halfway working. If you leave the

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.