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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:02:06+00:00 2026-06-13T22:02:06+00:00

In the FirstViewController of my survey app I have NSMutableArray that contains data (strings).

  • 0

In the FirstViewController of my survey app I have NSMutableArray that contains data (strings). I’ve also created date varibale. Here’s code

NSDateFormatter *dateformater=[[NSDateFormatter alloc] init];
[dateformater setDateFormat:@"EEEE,dd MMMM yyyy HH:mm a"];

NSDate *today=[NSDate date];
NSString *currentDate=[dateformater stringFromDate:today];

Now I want with the help of NSUserDefaults save data from the array and also save date variable when the survey has been taken and display it in the SecondViewController’s tableview (first user can see date of the survey and then by tapping the date – data from array).

I know how NSUSerDefaults work but I don’t know how to put array by date variable to be shown in the SecondViewController. Can anyone help me on 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-13T22:02:08+00:00Added an answer on June 13, 2026 at 10:02 pm

    In AppDelegate.h file just declare variable…

    NSUserDefaults  *userDefaults;
    NSMutableArray *arrDate;
    

    after…

    In AppDelegate.m Fille in applicationDidFinishLonching: Method

        userDefaults = [NSUserDefaults standardUserDefaults];
        NSData *dataRepresentingtblArrayForSearch = [userDefaults objectForKey:@"arrDate"];
        if (dataRepresentingtblArrayForSearch != nil) {
            NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingtblArrayForSearch];
            if (oldSavedArray != nil)
                arrDate = [[NSMutableArray alloc] initWithArray:oldSavedArray];
            else
                arrDate = [[NSMutableArray alloc] init];
        } else {
            arrDate = [[NSMutableArray alloc] init];
        }
        [arrDate retain];
    

    after that when you want to insert,update or delete Data from this UserDefaults Use Bellow Code…

    for Delete record from array

    [appDelegate.arrDate removeObjectAtIndex:Index];/// give the integer value instead of Index
        
    

    and this is for add record in array..

    [appDelegate.arrDate addObject:currentDate];///add value or add date here
    

    after in final save this modification in array just archive like bellow..

    NSData *data=[NSKeyedArchiver archivedDataWithRootObject:appDelegate.arrDate];
    [appDelegate.userDefaults setObject:data forKey:@"arrDate"];
    [appDelegate.userDefaults synchronize];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created an app that contains 4 viewcontroller and its .h,.m files...In my firstviewcontroller
I created a new Tab Bar app project that gave me a FirstViewController.xib and
I have a UIViewController (firstViewController) which has a button that 'segue's to another UIViewController
In my FirstViewController I have write this code for switch background if device is
I have a UIViewController that contains other ViewControllers. Initial ViewController is set in viewDidLoad:
I have this code: -(IBAction) doSomething{ FirstViewController *firstViewController = [[[FirstViewController alloc]init]autorelease]; [firstViewController.label1 setAlpha:1.00]; [firstViewController.label2
So i have two view controller in FirstViewController and SecondViewController in FirstViewController NSMutableArray *array;
I have an iPhone app with FirstViewController and SecondViewController with respective views FirstView.xib and
In my AppDelegate I have the following code: UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@FirstViewController
I have a UIViewController NavigationViewController that is added as a subview of my FirstViewController

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.