I am running into major issues developing my iphone app.
here is the full error:
CoreData: error: Serious application error. Exception was caught during Core Data
change processing. This is usually a bug within an observer of
NSManagedObjectContextObjectsDidChangeNotification. -[TimeSpentStudying coordinate]:
unrecognized selector sent to instance 0x21db92d0 with userInfo (null)
This is weird because I have two coreData entities ( Locations & TimeSpentStudying). But I dont think those are the problems. [TimeSpentStudying coordinate]
is weird, because I do not have a coordinate
property sent on TimeSpentStudying
core data class
I have a mapView set up, and when a user taps on the detail disclosure button on an mkannotationview, a new view (LibraryTrackTimeViewController) pops up, but is pretty much unusable. I tried calling NSLog in viewDidLoad and nothing showed up.
mapViewController.m
#pragma mark - NSNotification
- (void)contextDidChange:(NSNotification *)notification
{
if ([self isViewLoaded]) {
[self updateLocations];
}
.
- (void)updateLocations
{
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Location" inManagedObjectContext:self.managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:entity];
NSError *error;
NSArray * foundObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
if (foundObjects == nil) {
FATAL_CORE_DATA_ERROR(error);
return;
}
if (locations != nil) {
[self.mapView removeAnnotations:locations];
}
locations = foundObjects;
[self.mapView addAnnotations:locations];
}
-(void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSManagedObjectContextObjectsDidChangeNotification
object:self.managedObjectContext];
}
the error I think might have to do with the prepareForSegue method in mapViewController.m
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if (distance < 500) {
if ([segue.identifier isEqualToString:@"TrackLibraryTimes"]) {
UINavigationController *navigationController = segue.destinationViewController;
LibraryTrackTimeViewController *controller = (LibraryTrackTimeViewController *)navigationController.topViewController;
controller.managedObjectContext = self.managedObjectContext;
}
}}
I apologize for the rough syntax, I am just getting used to SO, if you need any more code, please let me know, thanks all.
I had same error, due to
-(void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath
case NSFetchedResultsChangeInsert:
//[self.tableView insert
NSLog(@"change insert");
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
break;
I had used indexPath
instead of newIndexPath.