title: iOS: filling tableView from SQLite database
body: <p>I'm trying to fill a tableView with info extracted from an SQLite database... I've read some tutorials and tried to follow them, but for some reason, my app keeps crashing...</p>
  
  <p>.h</p>
  
  <pre><code>//
  //  InOrder.h
  //  AGKUnsten
  //
  //  Created by Jonas Christensen on 7/12/11.
  //  Copyright 2011 __MyCompanyName__. All rights reserved.
  //
  
  #import &lt;UIKit/UIKit.h&gt;
  
  @interface InOrder : UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; {
  
      NSArray *artworkInfo;
      int rowsInDatabase;
  }
  </code></pre>
  
  <p>.m</p>
  
  <pre><code>@property (nonatomic, retain) NSArray *artworkInfo;
  
  @end
  
  
  //
  //  InOrder.m
  //  AGKUnsten
  //
  //  Created by Jonas Christensen on 7/12/11.
  //  Copyright 2011 __MyCompanyName__. All rights reserved.
  //
  
  #import "InOrder.h"
  #import "ArtworkView.h"
  #import "PaintingInfo.h"
  #import "PaintingDatabase.h"
  
  @implementation InOrder
  
  @synthesize artworkInfo;
  
  -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
  }
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  
      return 1;
  }
  
  -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      return rowsInDatabase;
      //return [artworkInfo count]; //Tried to use this, but app just crashes when it reaches this line
  }
  
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"Cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) {
          cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
      }
  
      NSLog(@"test");//To see how far I get in the code - this is outputted
      //Configure the cell
  
      //APP CRASHES IF I TRY TO DO SOMETHING WITH MY DATABASE IN HERE
  
      //cell.textLabel.text = [artworkInfo objectAtIndex:indexPath.row];//Tried this
  
      //PaintingInfo *info = [artworkInfo objectAtIndex:indexPath.row];//Tried this
      //cell.textLabel.text = info.artist;
  
      //[[cell textLabel] setText:[artworkInfo objectAtIndex:[indexPath row]]];//Thread 1: Program received signal: "SIGABRT"
  
      NSLog(@"test2");//Never reach here if I uncomment any of the above
  
      return cell;
  }
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
          // Custom initialization
      }
      return self;
  }
  
  - (void)dealloc
  {
      [super dealloc];
  }
  
  - (void)didReceiveMemoryWarning
  {
      // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  
      // Release any cached data, images, etc that aren't in use.
  }
  
  #pragma mark - View lifecycle
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view from its nib.
      self.title = @"Værker";
  
      artworkInfo = [[PaintingDatabase database] findAllArtists];
  
      rowsInDatabase = [artworkInfo count];
      NSLog(@"%d", rowsInDatabase);
  
  }
  
  - (void)viewDidUnload
  {
      [super viewDidUnload];
  
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  
  @end
  </code></pre>
  
  <p>Any help would be greatly appreciated...
  I know my database works, as I'm able to get data from it elsewhere, but it seems that when I try to use it here, the app just crashes... </p>
  
  <p>It's mainly EXC_BAD_ACCESS and SIGABRT that get's displayed as the error...</p>
  
  <p>Now, I've been told that SIGABORT = "SIGABRT is the signal sent when the program is attempting to abort itself. Generally this is because something really bad has happened."</p>
  
  <p>and "EXC_BAD_ACCESS happens when a message is sent to an object that has already been released. By the time the error is caught, the call stack is usually gone especially if dealing with multiple threads."</p>
  
  <p>Well, great.. but I don't how to fix it... Any help?? </p>