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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:56:04+00:00 2026-05-28T01:56:04+00:00

I want to save the Notifications which come from server in my application and

  • 0

I want to save the Notifications which come from server in my application and also make a User Interface to give users the ability of chosing which Notification(message) to read. In a scheduled method my client controls for changes inside the server and the communication is in JSON format. I have parsed it and can see the results in NSLog(@"....",..) too. I also control the status of message from the server, if the status equals to 1 i will save the message and add a node to TableView.. Now, can anyone help me about how to transmit datas in NSMutableArray both to NSUserDefaults and TableView? I can Share code or JSON representation too if you want..
It will be better if you could explain with some code.. Thanks

I decided to share some of my code,

as i have writen under the code too, i want to display NSMutableArray in UITableView

    `-(IBAction)Accept:(id)sender
    {   userName=[[NSString alloc] initWithString:userNameField.text ];
        [userNameField setText:userName];
        NSUserDefaults *userNameDef= [NSUserDefaults standardUserDefaults];
        [userNameDef setObject:userName forKey:@"userNameKey"];
        password =[[NSString alloc] initWithString:passwordField.text];
        [passwordField setText:password];
        NSUserDefaults *passDef=[NSUserDefaults standardUserDefaults];
        [passDef setObject:password forKey:@"passwordKey"];
        serverIP=[[NSString alloc] initWithString: serverField.text];
        [serverField setText:serverIP];
        NSUserDefaults *serverDef=[NSUserDefaults standardUserDefaults];
        [serverDef setObject:serverIP forKey:@"serverIPKey"];
        [userNameDef synchronize];
        [serverDef synchronize];
        [passDef synchronize];


    UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"BNTPRO "
                                                      message:@"Your User Informations are going to be sent to server. Do you accept?"
                                                     delegate:self
                                            cancelButtonTitle:@"OK"
                                            otherButtonTitles:@"Cancel",  nil];
    [message show];
}



    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        NSString *title = [alertView buttonTitleAtIndex:buttonIndex];

        if([title isEqualToString:@"OK"])
        {
            if([userNameField.text isEqualToString:@""]|| [passwordField.text isEqualToString:@""] || [serverField.text length]<10) 
            {
                UIAlertView *message1 = [[UIAlertView alloc] initWithTitle:@"BNTPRO "
                                                                   message:@"Your User Informations are not defined properly!"
                                                                  delegate:nil
                                                         cancelButtonTitle:@"OK"
                                                         otherButtonTitles:  nil];

                [message1 show];


        [userNameField  resignFirstResponder];
            [passwordField resignFirstResponder];
            return;
        }
        //## GET code to here**
        NSString *str1=[@"?username=" stringByAppendingString:userNameField.text];
        NSString *str2=[@"&password=" stringByAppendingString:passwordField.text];
        NSString *str3=[str1 stringByAppendingString:str2];
        NSString *str4 =[@"http://" stringByAppendingString:serverField.text];


        NSURL *url=[NSURL URLWithString:[str4 stringByAppendingString:[@"/ipad/login.php" stringByAppendingString:str3]]];
        NSLog(@"%@\n",url);
        //get the url to jsondata
        NSData *jSonData=[NSData dataWithContentsOfURL:url];

        if (jSonData!=nil) {
            NSError *error=nil;
            id result=[NSJSONSerialization JSONObjectWithData:jSonData options:
                       NSJSONReadingMutableContainers error:&error];
            if (error==nil) {
                NSDictionary *mess=[result objectForKey:@"message"];
                NSDictionary *messContent=[mess valueForKeyPath:@"message"];
                NSDictionary *messDate=[mess valueForKeyPath:@"date"];
                NSDictionary *messID=[mess valueForKeyPath:@"ID"];
                NSDictionary    *messStatus=[mess valueForKey:@"status"];

                NSLog(@"%@ *** Message %@ \n Message Content: %@ \n Mesage ID: %@ \n Message Date: %@\n \nilhancetin MessageSatus: %@", result, mess, messContent, messID,messDate,messStatus);
                NSString*key1=[ result objectForKey:@"key" ];

                NSString *s1=[@"http://" stringByAppendingString:serverField.text];
                NSString *s2=[s1 stringByAppendingString:@"/ipad/button.php"];
                NSURL *url2=[NSURL URLWithString:[s2 stringByAppendingString:[@"?key=" stringByAppendingString:key1]]];
                NSLog(@"\n%@\n",url2 );
                NSData *data2=[NSData dataWithContentsOfURL:url2];
                id result2=[NSJSONSerialization JSONObjectWithData:data2 options:NSJSONReadingMutableContainers error:nil];

                NSMutableArray *mesID = [NSMutableArray array];//saving meesages to NSMutableArray
                NSMutableArray *status = [NSMutableArray array];    


                // i logged here and it saves  the data, now i want to display my data in table view

`

  • 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-28T01:56:05+00:00Added an answer on May 28, 2026 at 1:56 am

    save it in NSUserDefaults:

    [[NSUserDefaults standardUserDefaults]setObject:yourArray forKey:@"theArray"];
    

    get it from NSUserDefaults:

    [[NSUserDefaults standardUserDefaults]objectForKey:@"theArray"];
    

    setting values from an array to UITableViewCell:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *CellIdentifier = @"TheCell";
        UITableViewCell *_cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (_cell == nil) {
            _cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }
        _cell.textLabel.text = [yourArray objectAtIndex:indexPath.row];
        return _cell;
    }
    

    Hope it helps

    update

    don’t have a Mac nearby at the moment, so my answer might be a bit sloppy.

    In your header file don’t forget to add UITableViewDelegate and UITableViewDataSource, so it will look somewhat like that:

    @interface yourController : UIViewController <UITableViewDelegate, UITableViewDataSource, ... some others if you need it ...> {
    

    then in the implementation file(.m) you can just start typing

    -tableview
    

    and then use the autocompletion to get the methods that you need. You will most probably need these 3:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    
    - (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath
    

    depending on the needs of your app you might need more of them, but these 3 should be there.

    For more info about UITableView please check that link: http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html

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

Sidebar

Related Questions

I want to save the notifications, that come to my app from the server,
I want save user note which can not be remove if they update app
I want save the username and password when user login, and I added the
I want to save excel file which export data of grid view. I have
i want to save a balance of user, in the user table . the
I want to save a remote img-file to my server, but I don't know
My IOS application program have tableview in navigation controller secondview. I want to save
I want to build a application. In this application, we can save event in
in my application im exporting gridview data to excel sheet now i want save
I want to extract data from HTML table using Python script and save it

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.