title: UITableView not updating
body: <p>I'm using a Core Data model and a UITableViewController table view. My model seems to be working quite well however my table view is not updating when I add an entity to my model. The reason I believe my model is working is because when I add an entity nothing shows up in the view during run time, however if I cut the task then start it up new, suddenly the entity I previously created shows up in the table view.</p>
  
  <p>Here is my table view controller - AudioTableViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "Bank.h"
  #import "Player.h"
  
  @class Player;
  @interface AudioTableViewController : UITableViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; {
      Player *myMainMan;
  }
  
  -(void)addAudioEntityToArray:(AudioFile *)event;
  -(NSMutableArray *)recordingsArray;
  
  @end
  </code></pre>
  
  <p>AudioTableViewController.m (implementation file)</p>
  
  <pre><code>#import "AudioTableViewController.h"
  
  @implementation AudioTableViewController
  
  -(void)addAudioEntityToArray:(AudioFile *)event {
      NSIndexPath *indexPath;
  
      if(event.type) {
          [[MusikerViewController recordingsArray] addObject:event];//self?
          indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
      }else {
          [[MusikerViewController downloadsArray] addObject:event];
          indexPath = [NSIndexPath indexPathForRow:0 inSection:1];
      }
  
       [[self tableView] setEditing:YES animated:NO];
       [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                        withRowAnimation:UITableViewRowAnimationNone]; 
  }
  
  
  - (void)viewDidLoad {
        [[self tableView] reloadData];
        [super viewDidLoad];
  
        self.title = @"Audio Files";//put this in application delegate
  
        self.navigationItem.leftBarButtonItem = self.editButtonItem;
  }
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
      // Return the number of sections.
      return 2;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      // Return the number of rows in the section.    
  
      NSLog(@"Place I");
  
      if(section == 0) {
          return [[MusikerViewController recordingsArray] count];
      } else if (section == 1) {
          return [[MusikerViewController downloadsArray] count];
      }
  }
  </code></pre>
  
  <p>... more methods</p>
  
  <p>Here is part of my Bank class that might be relevant
  Bank.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;AudioToolbox/AudioToolbox.h&gt;
  #import "AudioFile.h"
  #import "AudioTableViewController.h"
  #import "MusikerAppDelegate.h"
  
  @interface Bank : NSObject &lt;UIAlertViewDelegate&gt; {
      NSManagedObjectContext *managedObjectContext;
      AudioFile *sound;
  }
  
  @property (retain, nonatomic) NSManagedObjectContext   *managedObjectContext;
  
  +(NSString *)getDataPath:(NSString *)fileExtDate;
  
  -(AudioFile *)addAudioFileEntityToModelWithDate:(NSDate *)theD andURLString:(NSString *)str;
  -(BOOL)removeAudioFromModel:(id)audio;
  -(NSMutableArray *)getFetchArray;
  
  @end
  </code></pre>
  
  <p>Bank.m</p>
  
  <pre><code>#import "Bank.h"
  
  @implementation Bank
  @synthesize managedObjectContext;
  
  - (AudioFile *)addAudioFileEntityToModelWithDate:(NSDate *)theD andURLString:(NSString *)str {
       sound = (AudioFile *)[NSEntityDescription insertNewObjectForEntityForName:@"AudioFile" inManagedObjectContext:managedObjectContext];
  
       sound.creationDate = theD;
       sound.soundPath = str; //set the sound path to the sound file's url
       [self alertForTitle];
  
       return sound;
  }
  
  - (BOOL)saveContext {
      NSError *error = nil;
      if(!managedObjectContext) {
          NSLog(@"managedObejctContext problem at saveContext Bank");
      }
  
      if (![managedObjectContext save:&amp;error]) {
          return NO;
      } else {
          return YES;
      }
  }
  
  - (NSMutableArray *)getFetchArray {
  
      NSLog(@"ManagedObjectContext at getFetchArray");
      NSLog(@"Context: %@",managedObjectContext);
  
      NSFetchRequest *request = [[NSFetchRequest alloc] init];
      if(!managedObjectContext) {
          NSLog(@"There is no managedObjectContext in getFetchArray Bank");
      }
         NSEntityDescription *entity = [NSEntityDescription entityForName:@"AudioFile" inManagedObjectContext:managedObjectContext];
      [request setEntity:entity];
  
      NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"creationDate" ascending:NO];
      NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
      [request setSortDescriptors:sortDescriptors];
      [sortDescriptors release];
      [sortDescriptor release];
  
      NSError *error = nil;
      NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&amp;error] mutableCopy];
      if (mutableFetchResults == nil) {
          NSLog(@"mutableFetchResults array is nil");
      } 
      [request release];
      return mutableFetchResults;
  }
  
  + (NSString *)getDataPath:(NSString *)fileExtDate {
  
      NSLog(@"getDataPath called");
  
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
      documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"Musik Directory"];         //changing the recording directory to Musik Directory
  
      NSError *error;
      if (![[NSFileManager defaultManager] fileExistsAtPath:documentsDirectory]) {
      [[NSFileManager defaultManager] createDirectoryAtPath:documentsDirectory withIntermediateDirectories:YES attributes:nil error:&amp;error]; 
          NSLog(@"In the if statement");
      }
  
      NSString *docPath = [documentsDirectory stringByAppendingPathComponent:fileExtDate];
  
      return docPath;
  
  }
  </code></pre>
  
  <p>Player.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;AVFoundation/AVFoundation.h&gt;
  #import "Bank.h"
  
  @class Bank;
  @interface Player : NSObject &lt;AVAudioPlayerDelegate, AVAudioRecorderDelegate&gt; {
  
  Bank *daBank;
  
  AVAudioPlayer *musicPlayer;
  AVAudioRecorder *musicRecorder;
  
  NSDate *myDate;
  NSString *strPath;
  
  NSString *documentPath_;
  NSMutableArray *arrayListOfRecordSound;
  }
  
  -(void)playSoundFile:(NSString *)soundFilePath;
  -(BOOL)saveRecordingWithDate:(NSDate *)theD andURLString:(NSString *)str;
  -(void)recordSomething;
  -(void)playRecording;
  -(void)play;
  
  + (NSString *)dateString:(NSDate *)date;
  + (NSString *)dateString;
  
  @end
  </code></pre>
  
  <p>Player.m</p>
  
  <pre><code>- (Bank *)daBank 
  {    
      if(!daBank) {
          daBank = [[Bank alloc] init];
      }
  
      return daBank;
  }
  
  -(BOOL)saveRecording { //this is the method that adds the new object to both the //model and view, the method that calls this method is not shown
      Bank *B = [MusikerViewController daBank];
      AudioTableViewController *ATVC2 = [MusikerViewController ATVControl];
      AudioFile *myAudioFileMusicX314 = [[B addAudioFileEntityToModelWithDate:myDate andURLString:strPath] retain];
  
      myAudioFileMusicX314.type = true;
  
      [ATVC2 addAudioEntityToArray:myAudioFileMusicX314]; 
  
      if(![B saveContext]) { 
          NSLog(@"addAudioFileEntityToModel is returning a nil managedObjectContext");
          return NO;
      }
  
      [myDate release];
      [strPath release];
      [myAudioFileMusicX314 release];
  [ATVC2 release];
  
      return YES;            
  }
  </code></pre>
  
  <p>Last but not least, MusikViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "Player.h"
  #import "Bank.h"
  #import &lt;QuartzCore/QuartzCore.h&gt;
  #import "MyButtonView.h"
  #import "AudioTableViewController.h"
  
  @class AudioTableViewController;
  @class Bank;
  @class Player;
  @interface MusikerViewController : UIViewController {
  ]    BOOL *pressed;
  }
  
  Player *myMainMan;
  Bank   *daBank;
  AudioTableViewController *ATVControl;
  NSMutableArray   *recordingsArray;
  NSMutableArray   *downloadsArray;
  
  + (Bank *)daBank;
  + (Player *)myMainMan;
  + (AudioTableViewController *)ATVControl;
  + (NSMutableArray *)recordingsArray;
  + (NSMutableArray *)downloadsArray;
  
  @end
  </code></pre>
  
  <p>MusikViewController.m </p>
  
  <pre><code>+ (NSMutableArray *)recordingsArray {
      NSLog(@"recordingsArray called");
  
      if(!recordingsArray) {
          recordingsArray = [[NSMutableArray alloc] init];
          NSMutableArray *bigTempArray = [[[[Bank alloc] init] autorelease] getFetchArray]; //change this
          for(AudioFile *af in bigTempArray)
              if(af.type) {
                  [recordingsArray addObject:af];
              }
          NSLog(@"recordingsArray exists");
      }
      return recordingsArray;
  }
  
  + (NSMutableArray *)downloadsArray {
      NSLog(@"recordingsArray called");
  
      if(!downloadsArray) {
          downloadsArray = [[NSMutableArray alloc] init];
          // if(!bigTempArray)
          NSMutableArray *bigTempArray = [[[[Bank alloc] init] autorelease] getFetchArray];
          for(AudioFile *af in bigTempArray)
              if(!af.type) {
                  [downloadsArray addObject:af];
              }
      }
      return downloadsArray;
  }
  </code></pre>
  
  <p>If there are any more methods that might be relevant, let me know and I will happily post them. </p>
  
  <p>I should also mention that, I can add a single entity to the array after I launch the app, but after that its the same problem.</p>