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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:37:21+00:00 2026-05-29T05:37:21+00:00

I am trying to store some stings into a plist file, the saving process

  • 0

I am trying to store some stings into a plist file, the saving process works fine, but these notes should be saved based on a specific date, for example I enter a note on 2 Feb then I need enter another note on 5 Feb, and when I move during these dates my notes should show on these dates. I would be grateful if you help me.

Here is my code:

//Save Setting ///////////////////
- (NSString *) saveFilePath
{
    NSArray *pathArray =
    NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSDate *date = [NSDate date];

    return [[pathArray objectAtIndex:0] stringByAppendingPathComponent:@"note.plist"];
}

- (void)applicationWillTerminate:(UIApplication *)application 
{
    NSArray *values = [[NSArray alloc] initWithObjects:saveTextToday.text ,nil];
    [values writeToFile:[self saveFilePath] atomically:YES];
    [values release];
}

- (void)viewDidLoad 
{
    ////Save Setting /////////////////////////////////////////////////
    NSString *myPath = [self saveFilePath];
    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:myPath];

    if (fileExists)
    {
        NSArray *values = [[NSArray alloc] initWithContentsOfFile:myPath];
        saveTextToday.text = [values objectAtIndex:0];
        [values release];
    }

    // notification
    UIApplication *myApp = [UIApplication sharedApplication];

    // add yourself to the dispatch table 
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(applicationWillTerminate:) 
                                                 name:UIApplicationWillTerminateNotification 
                                               object:myApp];
}
  • 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-29T05:37:21+00:00Added an answer on May 29, 2026 at 5:37 am

    It appears you’re saving an array to a file, but using a “.plist” file extension. While the file created will be a plist file, there is no date information in the content.

    Instead of an array, you could use an NSDictionary. Use the current date as the key, and the array you’re using now as the object. Like this:

     NSMutableDictionary *myDictionary = [NSMutableDictionary alloc] initWithContentsOfFile:myPath];
     NSString *todayKey = [self showPersianFullDate]; // or [self showPersianFullDate:[NSDate date]]
     [myDictionary setObject:saveTextToday.text forKey:todayKey];
     [myDictionary writeToFile:[self saveFilePath] atomically:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to store some data in a binary file: import os, pickle o
I'm trying to store the names of some variables inside strings. For example: Dim
I'm trying to design some tables to store some data, which has to be
I'm trying to store a password in a file that I'd like to retrieve
I'm trying to store an xml serialized object in a cookie, but i get
I am trying to store an xml value in my app.config file. The app.config
I am trying to write some code that will open a file, read its
I'm trying to POST some JSON and a binary file from an iPhone to
I am trying to export data into an analysis but I'm doing something wrong.
I am trying to figure out if I can store some strings in an

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.