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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:23:22+00:00 2026-05-26T01:23:22+00:00

I have a plist containing an array with three elements all of which are

  • 0

I have a plist containing an array with three elements all of which are dictionaries. These dictionaries contain four items each (latitude, longitude, title, subtitle). I want to loop through each of the elements and get the latitude and longitude (both of which are attributes of the dictionary).

The following code is used.

    - (void)loadAnnotations{

    //retrieve path of plist file and populate relevant types with its information
    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Places1" ofType:@"plist"];
    branchList = [[NSArray alloc] initWithContentsOfFile:plistPath];

     NSLog(@"hi inside method",branchList.lastObject);

    self.branchList =[NSMutableArray array];
    //code ok until this
   for (NSDictionary *key in branchList)
 {    NSLog(@"hi in loop");

        PlaceFinderAnnotation *placeAnnotations = [[PlaceFinderAnnotation alloc] init];  
        //loop through annotations array, creating parking annotations filled with the information found in the plist

            CLLocationDegrees latitude = [[key valueForKey:@"latitude"]floatValue];
            CLLocationDegrees longitude = [[key valueForKey:@"longitude"]floatValue];
            placeAnnotations.coordinate = CLLocationCoordinate2DMake(latitude, longitude);

            [self.branchList addObject:placeAnnotations];
            [placeAnnotations release]; placeAnnotations= nil;
            objectForKey:@"subtitle"]];

        }
    }

The problem is it doesnt go into the loop. meaning it doesnt print out the log command “hi inside the looppp”.

  • 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-26T01:23:22+00:00Added an answer on May 26, 2026 at 1:23 am

    Let’s assume this code succeeded (we have to assume because you don’t appear to be checking to make sure). Let’s also assume (because you don’t say) “branchList” is an instance variable in the current class:

    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Places1" ofType:@"plist"];
    branchList = [[NSArray alloc] initWithContentsOfFile:plistPath];
    

    This hopefully leaves you with an array. You could of course eliminate the “hopefully” by … checking to make sure it leaves you with an array ( if (branchList)... ). Then, since “branchList” seems to be an instance variable, you immediately blow it away by replacing it with an empty array (using an accessor rather than setting it directly as you did above):

    self.branchList =[NSMutableArray array];
    

    …so then you try to iterate an empty loop (so the NSLog() statement is never executed).

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

Sidebar

Related Questions

I have a plist (array of dictionaries) with 20 items, each of the 20
I have a plist file which contains an array of dictionaries. Here is one
I have a plist which contains an array of NSDictionary 's which represent a
If I have a plist which is structured like this: Root Array Item 0
If I have a plist which I have put into and array, which looks
In my Iphone application i have .plist file in which i am putting all
I have a plist with root of type dictionary containing keys of type array,
I have a plist. It has several dozen keys, each with NSMutableArray items: ...
I have a pList in which I have 5 Dictionary items. I'm trying to
i have a plist that's at its root an array with dictonaries inside it.

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.