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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:14:47+00:00 2026-06-03T14:14:47+00:00

I worked CoreData into my Tab Bar app and the CoreData functions are working

  • 0

I worked CoreData into my Tab Bar app and the CoreData functions are working (i.e. I can output information from it to the console). The problem is that my tab bar isn’t working. When I run my app, it looks like this:

enter image description here

It looks as if the tab bar itself is showing up but there aren’t any items and it isn’t displaying the table view. My storyboard looks like this:

enter image description here

Here is the code for my AppDelegate:

AppDelegate.h

#import <UIKit/UIKit.h>

#import "JobsViewController.h"
#import "Job.h"
#import "Shift.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;

@end

AppDelegate.m

#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize managedObjectContext = __managedObjectContext;
@synthesize managedObjectModel = __managedObjectModel;
@synthesize persistentStoreCoordinator = __persistentStoreCoordinator;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    NSManagedObjectContext *context = [self managedObjectContext];
    Job *job = [NSEntityDescription insertNewObjectForEntityForName:@"Job" inManagedObjectContext:context];
    job.employer = @"Calder Centre";
    job.jobTitle = @"Addictions Counsellor";
    job.regularRate = 25.9f;
    job.overtimeRate = 30.5f;
    job.deduction1 = 0.1f;
    job.deduction2 = 0.2f;
    job.deduction3 = 0.3f;
    job.deduction4 = 0.4f;
    job.deduction1Name = @"CPP";
    job.deduction2Name = @"IT";
    job.deduction3Name = @"Union Dues";
    job.deduction4Name = @"Other";

    Shift *shift = [NSEntityDescription insertNewObjectForEntityForName:@"Shift" inManagedObjectContext:context];
    shift.startDate = [NSDate date];
    shift.endDate = [NSDate date];

    NSError *error;
    if (![context save:&error]) {
        NSLog(@"Whoops, couldn't save: %@", [error localizedDescription]);
    }

    // Test listing all FailedBankInfos from the store
    NSFetchRequest *jobFetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *jobEntity = [NSEntityDescription entityForName:@"Job" inManagedObjectContext:context];
    [jobFetchRequest setEntity:jobEntity];
    NSArray *fetchedJobs = [context executeFetchRequest:jobFetchRequest error:&error];
    for (Job *job in fetchedJobs) {
        NSLog(@"Employer: %@", job.employer);
        NSLog(@"Title: %@", job.jobTitle);
    }

    NSFetchRequest *shiftFetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *shiftEntity = [NSEntityDescription entityForName:@"Shift" inManagedObjectContext:context];
    [shiftFetchRequest setEntity:shiftEntity];
    NSArray *fetchedShifts = [context executeFetchRequest:shiftFetchRequest error:&error];
    for (Shift *shift in fetchedShifts) {
        NSLog(@"Start Date: %@", shift.startDate);
        NSLog(@"End Date: %@", shift.endDate);
    }

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    UITabBarController *tabBarController = [[UITabBarController alloc]init];
    self.window.rootViewController = tabBarController;

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return YES;
}

Here is the view controller:

JobsViewController.h

#import <UIKit/UIKit.h>
#import "Job.h"
#import "Shift.h"

@interface JobsViewController : UITableViewController

@property (nonatomic, strong) NSManagedObjectContext* managedObjectContext;
@property (nonatomic, strong) NSArray *listOfJobs;

@end

JobsViewController.m

#import "JobsViewController.h"

@interface JobsViewController ()

@end

@implementation JobsViewController

@synthesize managedObjectContext, listOfJobs;

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    self.navigationItem.rightBarButtonItem = self.editButtonItem;

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription 
                                   entityForName:@"Job" inManagedObjectContext:managedObjectContext];
    [fetchRequest setEntity:entity];
    NSError *error;
    self.listOfJobs = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
    self.title = @"Jobs";
}

#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.
    return [listOfJobs count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"job";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    // Configure the cell...
    Job *job = [listOfJobs objectAtIndex:indexPath.row];
    cell.textLabel.text = job.jobTitle;
    cell.detailTextLabel.text = job.employer;

    return cell;
}
  • 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-03T14:14:48+00:00Added an answer on June 3, 2026 at 2:14 pm

    This has nothing to do with core data.

    You are using code from an app delegate template for a non-storyboard project, but you are using a storyboard. The code in your didFinishLaunching method is creating a new window and empty tab bar controller, which is overriding anything from your storyboard.

    Get rid of everything after self.window =, except return YES;. This is code used in xib-based applications and is not necessary if you have a storyboard.

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

Sidebar

Related Questions

Simple problem, but for me, tough execution. I'm working solely on an app that
I worked with a graphic designer that did not clone from my github account.
I am working on an app that uses Core Data as its backend for
While working on a project I ran into the following Issue, in my CoreData
I created an iOS app that allowed me to enter data into database and
I have an iPhone app that is using CoreData. I recently made some minor
I worked out an XSL template that rewrites all hyperlinks on an HTML page,
I previously worked a lot with Java and now I am working more with
In the app I am working on now I was storing about 500 images
In a previous project, I built an iPhone app for 2.2.x that used SQLite.

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.