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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:00:41+00:00 2026-06-07T23:00:41+00:00

I am developing an application which includes 5 plist files. I want to save

  • 0

I am developing an application which includes 5 plist files. I want to save all those files in documents directory. Because I want to add data to them dynamically. I am Creating a plist path using

Retrieving data from plist

NSMutableArray *pathsArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docpath = [pathsArray objectAtIndex:0];
NSString *scorePlistPath = [docpath stringByAppendingPathComponent:@"highScores.plist"];

if (![[NSFileManager defaultManager] fileExistsAtPath:scorePlistPath]) {
    scorePlistPath = [[NSBundle mainBundle] pathForResource:@"highScores" ofType:@"plist"];
}
highScoreArray = [[NSMutableArray alloc]initWithContentsOfFile:scorePlistPath];

Writing data to plist

scorePlistPath = [docpath stringByAppendingPathComponent:@"highScores.plist"];

[highScoreArray writeToFile:scorePlistPath atomically:YES];

Now I want to add one more plists in documents directory.. Not in the Bundle. How can i do that..?

  • 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-07T23:00:43+00:00Added an answer on June 7, 2026 at 11:00 pm

    programatically you cannot add files into the application bundle because you don’t have permission and to save or load the files from the Documents folder is not a big deal:

    first, you need to define the URL where the file is:

    NSString *_filename = @"myOwn.plist";
    NSURL *_resourceURL = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:_fileName];
    

    then you can save the file:

    NSArray *_array = // your array as you defined
    [_array writeToURL:_resourceURL atomically:true];
    

    and anytime the file can be loaded again:

    NSData *_plistData = [NSData dataWithContentsOfFile:[_resourceURL path]];
    NSArray *_loadedArray = [NSPropertyListSerialization propertyListFromData:_plistData mutabilityOption:NSPropertyListImmutable format:nil errorDescription:nil]; // the option or the format parameter might be set for your special wishes, so check the documentation, please
    

    and violá, it is done.

    UPDATE #1

    this code is working perfectly on any real device with iOS4.3+, it has never been tested on the simulator.

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

Sidebar

Related Questions

I'm currently developing an application for a company which includes livescoring. The XML-files I
We've been developing an Android application which includes Google Adsense. However there seems to
I`m developing an application which receives data from my GPS device like coordinates, speed
I am developing an application which requires the reading and writing of XML files.
I was working on a project which includes developing an application using java sockets.
I am developing an application which includes a WCF service and its ASP.NET MVC
We are developing a mobile dating application which includes the following features: Manage Photos:
I am developing one application which include the email sending functionality (which is like
I am developing application which is having Gujarati font in text-view but my problem
When developing an application which mostly interacts with a database, what is a good

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.