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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:40:41+00:00 2026-06-05T21:40:41+00:00

my app stores players’s data and I want to populate a UITableView with it,

  • 0

my app stores players’s data and I want to populate a UITableView with it, but I’m afraid I’m a bit lost.

Here’s my code:

ShowResults.h
#import <UIKit/UIKit.h>

@interface ShowResults : UITableViewController<UITableViewDelegate,UITableViewDataSource, NSFetchedResultsControllerDelegate>

{
    NSManagedObjectContext *managedObjectContext;
    NSFetchedResultsController *fetchedResulstController;
    NSArray *fetchedObjects;
}

@property (nonatomic) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic) NSManagedObjectContext *managedObjectContext;
@property (nonatomic,strong)  NSArray *fetchedObjects;
@end



ShowResults.m
#import "ShowResults.h"
#import "F1AppDelegate.h"
@interface ShowResults ()
@end

@implementation ShowResults
@synthesize managedObjectContext;
@synthesize fetchedResultsController;
@synthesize fetchedObjects;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

F1AppDelegate *appDelegate =[[UIApplication sharedApplication]delegate];
NSManagedObjectContext *context =[appDelegate managedObjectContext];
NSError *error;

if (managedObjectContext != nil) {
    if ([managedObjectContext hasChanges] &&[managedObjectContext save:&error]) {
        NSLog(@"Unresolved error %@,%@",error, [error userInfo]);  
        abort();
    }
}

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription 
                               entityForName:@"Players" inManagedObjectContext:context];

[fetchRequest setEntity:entity];
fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
// Test reading core data

for (NSManagedObject *player in fetchedObjects) {

    NSLog(@"Name: %@", [player valueForKey:@"name"]);
    NSLog(@"Surname: %@", [player valueForKey:@"surname"]);
    NSLog(@"Address: %@", [player valueForKey:@"address"]);
    NSLog(@"Email: %@", [player valueForKey:@"email"]);
    NSLog(@"Phone: %@", [player valueForKey:@"phone"]);
    NSLog(@"City: %@", [player valueForKey:@"city"]);
    NSLog(@"Country: %@", [player valueForKey:@"country"]);
    NSLog(@"Store: %@", [player valueForKey:@"store"]);
    NSLog(@"Age: %@", [player valueForKey:@"age"]);
    NSLog(@"Gender: %@", [player valueForKey:@"gender"]);
    NSLog(@"Time: %@", [player valueForKey:@"time"]);

   }        
// End test
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
     return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    NSInteger rows = [fetchedObjects count];
    return rows;
 }

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *MyIdentifier = @"MyIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
   }

 NSString *pieceOfData  =[NSString stringWithFormat:@"%@", [fetchedObjects objectAtIndex:indexPath.row]];
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:14];   
cell.textLabel.text = pieceOfData;
NSLog(@"cellContent: %@",pieceOfData);
return cell;
}
@end

What I get on console output is

Name: Otto
Surname: Von Bismarck
Address: Schuhe, 3
Email: otto@munchen.de
Phone: +34988556633
City: MÜNCHEN
Country: GERMANY
Store: MÜNCHEN
Age: 44
Gender: Male
Time: 03:01:00

cellContent: <Players: 0x6b8f3c0> (entity: Players; id: 0x6b8b450 <x-coredata://C61C85CA-EB53-4B88-87AF-CC45EABFF8ED/Players/p1> ; data: {
address = "Schuhe, 3";
age = 44;
city = "M\U00dcNCHEN";
country = GERMANY;
email = "otto@munchen.de";
gender = Male;
name = Otto;
phone = "+34988556633";
store = "M\U00dcNCHEN";
surname = "Von Bismarck";
time = "03:01:00";
})

Can you help me to write these values into the tableView cells?

Thanks !

  • 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-05T21:40:44+00:00Added an answer on June 5, 2026 at 9:40 pm

    It looks like you are just need to do something like this:

    // in your cellForRowAtIndexPath:
    Players *player = [fetchedObjects objectAtIndex:indexPath.row];
    // switch email for whatever other property you want to display
    cell.textLabel.text = player.email;
    

    It also looks like you might need to import Players.h into your class.

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

Sidebar

Related Questions

i wrote a java app that communicates and stores data in oracle; my question
I'm struggeling with a problem. I want to sell one app in AppStore. But,
Our google app engine app stores a fair amount of personally identifying information (email,
I have built an app that stores dates entered by the user in an
I am working with a database from a legacy app which stores 24 floating
My script stores a bunch of External application commands from an app like so
I use a lot of Sencha stores in my app. Is there a way
In my app, I have a simple ASCII file which stores some config info
I have a rest app with resteasy, which creates files and stores them and
I've developed a CMS app, that stores all the client's files on their server

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.