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

  • Home
  • SEARCH
  • 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 5967823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:59:58+00:00 2026-05-22T19:59:58+00:00

I would like to read data from a plist, add some elements and the

  • 0

I would like to read data from a plist, add some elements and the write the data to a plist.(update a plist).

I want to have the plist hold an array of dictionaries, read this array into my app, add dictionaries and then write the array back to the plist.

How is this done? Im also not sure where and how to create the plist on the apps first launch. or should it be placed in the bundle from the beginning?

Another thing I am not sure about is if the plist dictionaries can hold e.g. CLLocations as values for keys? Will it be saved correctly or would the CLLocation need to be broken into lat and lon values?

Thanks

  • 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-22T19:59:59+00:00Added an answer on May 22, 2026 at 7:59 pm

    The easiest way to create a dictionary from a plist is to use the method dictionaryWithContentsOfFile:, for example, to load a plist from your resources:

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MyPlist" ofType:@"plist"];
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:filePath];
    

    Writing a plist is equally simple:

    [dict writeToFile:filePath atomically:YES];
    

    (Note that you can’t write into your app’s resources, so you’ll have to create a different path, e.g. in your Documents directory, see NSSearchPathForDirectoriesInDomains)

    Plists can only contain instances of NSDictionary, NSArray, NSNumber and NSString, so you can’t put a CLLocation in a Plist without conversion. If you need to save non-Plist objects, have a look at NSKeyedArchiver. It can create files and NSData objects from anything that adopts the NSCoding protocol (CLLocation does).

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

Sidebar

Related Questions

I would like to read some data from a stream I have using std::getline
I have a byte array in memory, read from a file. I would like
I would like to write a function which will read values from a text
I would like to read/write encrypted XML files using LINQ to XML. Does anyone
I have found C++ FQA Lite very edificatory and would like to read more
I am using SqlDataReader to read data from SQL Server. However sometimes I want
I have been looking for good newbie-advice on how to efficiently read data from
I would like to create a stacked bar chart based on data from a
I would like to read the text and binary attachments in a saved Outlook
I would like to sort an array in ascending order using C/C++ . The

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.