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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:58:14+00:00 2026-05-25T23:58:14+00:00

I have the following plist: <plist version=1.0> <array> <dict> <key>description</key> <string>Dodge Viper</string> <key>title</key> <string>Bil</string>

  • 0

I have the following plist:

    <plist version="1.0">
<array>
    <dict>
        <key>description</key>
        <string>Dodge Viper</string>
        <key>title</key>
        <string>Bil</string>
        <key>longitude</key>
        <real>19.027054</real>
        <key>latitude</key>
        <real>36.129471</real>
        <key>show</key>
        <true/>
    </dict>
    <dict>
        <key>description</key>
        <string>Dodge RAM</string>
        <key>title</key>
        <string>Truck</string>
        <key>longitude</key>
        <real>1.026062</real>
        <key>latitude</key>
        <real>46.128918</real>
        <key>show</key>
        <true/>
    </dict>
    <dict>
        <key>description</key>
        <string>Tøf tøf</string>
        <key>title</key>
        <string>Lastbil</string>
        <key>longitude</key>
        <integer>0</integer>
        <key>latitude</key>
        <real>56.128918</real>
        <key>show</key>
        <true/>
    </dict>
    <dict>
        <key>description</key>
        <string>Black Pearl</string>
        <key>title</key>
        <string>Piratskib</string>
        <key>longitude</key>
        <integer>0</integer>
        <key>latitude</key>
        <real>25.128918</real>
        <key>show</key>
        <false/>
    </dict>
</array>
</plist>

And I have a basic mapview controller.

What I would like is to create annotations for each item using the longitude and altitude key.

Problem is, when I try I get problems with “double” -> I don’t know how to read my value from the plist as a double, I have tried converting it, but it doesn’t seem to work.

My code in the map view controller is like this:

Currently there’s a problem at “double latitude2 = [str objectForKey:@”latitude”];” but I included the line anyway to show my intentions.

-(void)viewDidLoad {
    [super viewDidLoad];



    NSString *path = [[NSBundle mainBundle] pathForResource:
                      @"enheder" ofType:@"plist"];

    NSMutableArray *array2 = [[NSMutableArray alloc] initWithContentsOfFile:path];

    for (NSString *str in array2) {

        double latitude2 = [str objectForKey:@"latitude"];


    [mapview setMapType:MKMapTypeHybrid];
    [mapview setZoomEnabled:YES];
    [mapview setScrollEnabled:YES];

    MKCoordinateRegion region = { {0.0, 0.0 }, {0.0, 0.0 } };
    region.center.latitude = latitude2;
    region.center.longitude = 9.027044;
    region.span.longitudeDelta = 0.001f;
    region.span.latitudeDelta = 0.001f;
    [mapview setRegion:region animated:YES];

    NewClass *ann = [[NewClass alloc] init];
    ann.title = @"Title";
    ann.subtitle = @"Sub";
    ann.coordinate = region.center;
    [mapview addAnnotation:ann];

   }  




}

I am very much a novice when it comes to programming for iPhone, so it’s very likely I’ve missed something fundamental. But any help would be much appreciated.

  • 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-25T23:58:15+00:00Added an answer on May 25, 2026 at 11:58 pm

    Your plist han an array of dictionary not an array of strings. change your code in this way

    for (NSDictionary *dict in array2) 
        double latitude2 = [[dict objectForKey:@"latitude"] doubleValue];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML <plist version=1.0> <dict> <key>items</key> <array> <dict> <key>assets</key> <array> <dict>
In my app-info.plist I have the following: <key>CFBundleURLSchemes</key> <array> <string>fb17372828282822</string> </array> How do I
I have a plist with the following structure: <plist version=1.0> <dict> <key>000001</key> <dict> <key>name</key>
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
I have the following code. It's not finding my resource: string filename = Resources/Functions.plist;
I have a settings bundle in my iPhone app, with the following PList: Type:
I have following string String str = replace :) :) with some other string;
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have an array of dictionaries loaded from a plist (below) called arrayHistory. <plist
I have the following code that loads a plist file from the resource folder

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.