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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:53:17+00:00 2026-05-17T18:53:17+00:00

I use the following code to write to the plist (assuming dict is already

  • 0

I use the following code to write to the plist (assuming dict is already populated):

[dict writeToFile:[appDelegate dataFilePath] atomically:YES];

where in my App Delegate:

- (NSString *)dataFilePath {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    return [documentsDirectory stringByAppendingPathComponent:kFilename];
}

And I read the plist from disk using this:

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:[appDelegate dataFilePath]];

This worked when compiling my app for 4.2, but since I brought it down to 4.1 for distribution, it stopped working.

[dict writeToFile:[appDelegate dataFilePath] atomically:YES];

returns NO. What’s wrong here?

  • 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-17T18:53:17+00:00Added an answer on May 17, 2026 at 6:53 pm

    I would guess that some other change is resulting in an object of non-plist type being present in your dictionary. See what happens if you separate out the “generate plist” and “write plist” steps:

    /* Generate plist. */
    NSError *error = nil;
    NSData *data = [NSPropertyListSerialization
                    dataFromPropertyList:dict
                    format:NSPropertyListBinaryFormat_v1_0
                    options:0/*unused*/
                    error:&error];
    if (!data) {
        NSLog(@"%s: Failed to serialize data: %@", __func__, error);
        return;
    }
    
    /* Write data. */
    NSString *path = [appDelegate dataFilePath];
    BOOL ok = [data writeToFile:dataFilePath options:NSDataWritingAtomic error:&error];
    if (!ok) {
        NSLog(@"%s: Failed to write atomically to path %@: %@", __func__, path, error);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use VS2010, C# to develop Silverlight 4 app, I use following code in
I use the following code to write cache header on *.png requests: response.Buffer =
When I use the following code to write to Application Event log, everything works
In the following code document.write(<h1> + Date() + <\/h1>); I need to use \
I am trying to use the following code to write out all processes started
I use the following code to copy a Resources plist file into the documents
I use the following code (from Bluetooth Chat sample app) to read the incoming
I am trying to use the following code to write data into an excel
I use following code: Create a retry policy, when error, retry after 1 second,
I just use following code to add an image to my project, var paper

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.