Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone iOS 4 Core Data - Program received signal: “EXC_BAD_ACCESS”
    primarykey
    data
    text
    <p>I'm trying to create an app based on Apple's example project TheElements, but using Core Data for the model. In Core Data I have 4 related DB tables. In the UI I have several tableViews, each showing rows from a different Db table. Clicking a row in a tableView drills down to items in a related table, shown in another TableView. </p> <p>Everything is working but the app crashes unexpectedly at random times with the error: Program received signal: “EXC_BAD_ACCESS”. BTW this error only shows in the console when debugging on the device. No error shows when debugging on the simulator. This <a href="http://i.stack.imgur.com/muyGU.png" rel="nofollow">screen grab</a> shows the contents of the debugger after a crash.</p> <p>I have no idea how to decipher the debugger. All I can see is the crash seems to stem from the main() function and _PFManagedObjectReferenceQueue is also listed, which leads to guess that I'm doing something wrong with Core Data.</p> <p>To implement Core Data I'm adding the following to my App Delegate header:</p> <pre><code>@private NSManagedObjectContext *managedObjectContext_; NSManagedObjectModel *managedObjectModel_; NSPersistentStoreCoordinator *persistentStoreCoordinator_; @property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext; @property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel; @property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator </code></pre> <p>and adding Apple's default methods for these to App Delegate implementation file.</p> <p>Then to my Data Source Protocol header I've added:</p> <pre><code>@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController; @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;` </code></pre> <p>and my Data Source header files are as follows:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import &lt;CoreData/CoreData.h&gt; #import "TableViewDataSourceProtocol.h" @interface MatchesAllDataSource : NSObject &lt;UITableViewDataSource,TableViewDataSource, NSFetchedResultsControllerDelegate&gt; { NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } @end </code></pre> <p>When a table cell is clicked I pass the selectedObject as follows:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath { // deselect the new row using animation [tableView deselectRowAtIndexPath:newIndexPath animated:YES]; // get the element that is represented by the selected row. Match *selectedMatch = [dataSource objectForIndexPath:newIndexPath]; // create an AtomicElementViewController. This controller will display the full size tile for the element MatchViewController *matchController = [[MatchViewController alloc] init]; // set the element for the controller matchController.selectedMatch = selectedMatch; // push the element view controller onto the navigation stack to display it [[self navigationController] pushViewController:matchController animated:YES]; [matchController release]; }` </code></pre> <p>Does anyone have any idea what might be causing my crash? Will someone please point me in the right direction to look for an answer?<br> Is there a better way to implement Core Data with multiple tableViews? Will someone point me to a good example of Core Data with multiple tableViews?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload