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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:10:50+00:00 2026-06-03T00:10:50+00:00

I have two json files which are linked by key country_id (one country –

  • 0

I have two json files which are linked by key country_id (one country – many cities), data from a json file I write in NSDictionary s.

question : if i selected one of the countries from first NSDictionary (dictionary of countries data) how to show all the data that is bind to selected country_id in other dictionary(dictionary of cities data)?


What i tried?

I tried to do next:check all key values of second NSDictionary(dictionary of cities data) is they equal to selected county_id

    //dict3 - dictionary of cities data
  for (int i = 0; i<=[[dict3 valueForKey:@"country_id"] count];i++)
      {
      if ([[[dict3 valueForKey:@"country_id"] objectAtIndex:i] isEqualToString:appDelegate.idSelectedCountry])
      {
        NSLog(@"object %@",[nameCities objectAtIndex:i]);   //array of cities name
      }} 

But because my JSON files are quite big this is takes too long to compute.

  • 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-03T00:10:51+00:00Added an answer on June 3, 2026 at 12:10 am

    You should use Core data for this kind of thing and have there a relation on City and Country entity. it will be faster and more correct. Look at this tutorial:
    http://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started

    Update:
    If you want for some reasons really use NSDictionary as you do now, you can at least employ blocks. It is little bit faster than loops:

    [dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
        [self processKey:key value:obj];
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two datatables, one which lists foldes, and another which list's files within
I have a file which contains two JSON arrays; one is holding the column
I am trying to build JSON from two fields. Say, I have a list
I have a JSON file which contains data like the following: {"posts": [ {
I have problem with creating constructor, which Jenkins can call for some JSON data
I just ran into something weird. I have two JSON arrays which holds different
I have a json object(say dobject) returning data from a json file Here is
I have two .json files data_prod_ind.json {articles: [ { title:bla bla } , {
Two questions here. I have a set of files which are usually UTF-8 with
I have a grid which uses a store, the store takes the data from

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.