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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:16:33+00:00 2026-05-23T20:16:33+00:00

I have a KML file I am calling with a NSURL every 10 seconds.

  • 0

I have a KML file I am calling with a NSURL every 10 seconds. In the method I am doing the following to store the latitude, longitude, and color of the data.

cachedData is a NSMutableArray instance variable.

masterData is a NSMutableArray instance variable.

masterDataCounter is an int instance variable.

[cachedData addObject:[[[NSDictionary alloc] 
                    initWithObjectsAndKeys:latitude,@"latitude",longitude,@"longitude",color,@"color",nil] autorelease]];

Once the data is parsed, I want to save the entire contents of the cachedData array into an associative array (masterData as stated above) so I can reference it by indexes and then clear the cachedData to save on memory.

Example

index of array | data stored

0 | the entire contents of cached data on the first pull

1 | the entire contents of cached data on the second pull

etc.

After the KML has parsed, I run this code:

[masterData insertObject:cachedData atIndex:masterDataCounter];
[cachedData removeAllObjects];
masterDataCounter++;

Is this a correct way? How can I reference for example the total number of data points stored in the second run?

Is that right? For some reason I’m not getting correct results when I try it:

[[masterData objectAtIndex:1] count];
  • 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-23T20:16:34+00:00Added an answer on May 23, 2026 at 8:16 pm

    For starters there is a better way to write the segment I described above.

    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:latitude,@"latitude",longitude,@"longitude",color,@"color",nil];
    [cachedData addObject:dict];
    [dict release];
    

    For the second code snippet, it could be rewritten as:

    [masterData insertObject:[[cachedData copy] autorelease] atIndex:masterDataCounter];
    masterDataCounter++;
    

    From this yes you can indeed reference the main masterData NSMutable array as the following:

    [[masterData objectAtIndex:desiredIndexNumber] count];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a KML-file with lots of data in it. I would like to
I can't get DDMS to load any KML files. I have a KML file
I have a KML file with a list of placemarks that have custom icons,
I have a KML file defining several paths/routes (representing actual roads) enclosed in the
I have a rails app that creates a kml file and successfully loads it
Do you have any idea where I could find kml file with simple contours
I'm trying to build a KML file in Rails, which I have done successfully,
I have a KML file with country borders <Document> ... <Folder> <name>Countries</name> <Style> <ListStyle>
I have a kml file. I need to load this kml file into my
I have this xml result from calling the page getRout.php <?xml version=1.0 encoding=UTF-8?> <kml

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.