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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:50:08+00:00 2026-05-23T04:50:08+00:00

I am parsing with the JSON parser. I stored the data into searchURL ,

  • 0

I am parsing with the JSON parser. I stored the data into searchURL, which is an NSMutableDictionary. I do get a JSON response.

       ksearchKeyHeadline = "noresults"
       ksearchKeyNewsText = "http://172.15.12.98:8080//...... url."
       ksearchKeyIssuersText= "noresults"

Here I am making conditions:

if ([[searchURL objectForKey:KSearchKeyHeadline] isEqualToString:@"noresults"] &&
    [[searchURL objectForKey:kSearchKeyNewsText] isEqualToString:@"noresults"] &&
    [[searchURL objectForKey:kSearchKeyIssuerText] isEqualToString:@"noresults"]) {
    NSURLRequest *req;
    req=[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:kSearchBarNoResult,text.text]]];
    [[[featuredAsset viewControler] iWebview] loadRequest:req];
}
else if([searchURL objectForKey:KSearchKeyHeadline]!=@"noresults" && 
        [searchURL objectForKey:kSearchKeyNewsText]!=@"noresults" && 
        [searchURL objectForKey:kSearchKeyIssuerText]!=@"noresults"){
    NSURLRequest *req;
    req=[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithString:kSearchBarHeadlinesURL]]];
    [[[featuredAsset viewControler] iWebview] loadRequest:req];
}
else if([[searchURL objectForKey:kSearchKeyNewsText]isEqualToString:@"noresults"] && 
        [searchURL objectForKey:kSearchKeyNewsText]!=@"noresults" &&
        [[searchURL objectForKey:kSearchKeyIssuerText]isEqualToString:@"noresults"]){
    NSURLRequest *req;
    req=[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithString:kSearchBarNewsTextURL]]];
    [[[featuredAsset viewControler]iWebview]loadRequest:req];
}

The problem is, it’s calling both else if conditions. I must call the last condition. I know the ampersand && will check the condition — when the entire condition is true, it returns true. What I am doing wrong?

  • 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-23T04:50:09+00:00Added an answer on May 23, 2026 at 4:50 am

    You can’t compare NSStrings like this:

    [searchURL objectForKey:KSearchKeyHeadline]!=@"noresults"
    

    you need to use isEqualToString:

    [[searchURL objectForKey:KSearchKeyHeadline] isEqualToString: @"noresults"]
    

    Also your ksearchKeyHeadline is "noresult", not "noresults".

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

Sidebar

Related Questions

I am doing some json parsing in a bash script: curl http://myurl.com/get.json | sed
I am having trouble parsing my JSON which i get from javascript. The format
I have an Android app which uses Jackson parser for JSON parsing. After I've
In JSON parse, save the parsing data into NSDictionary, And read the key-value like:
I write a java program that has a json parser to get some data.
I have a list of places in listview which i got from parsing JSON.
I'm trying to work on a new project parsing some JSON data for a
I am trying to re-load data into the Store which is further used by
I have recently started parsing JSON documents using SBJSON Parser, and I am able
I am writing a custom textfile-data parser (JSON-like) and I have lost many hours

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.