Hi
I am having a weird problem occur. I have made a screen that creates a new Football Fixture.
I take in an opposition (UITextField), a game date (date) and then I have a dropdown that is powered by a another core Date object that lists all of my teams (Team object).
Now I can add and edit Games fine and view them in the table. But when I try to make my tableView work by breaking my Games into a team section I am having problems.
I have two available teams that I can pick from when creating/editing a Football Fixture. But I am unable to update or create a fixture when the second Team is selected.
I have included my code, which works when no sections are involved. And commented out the pieces that are seeming to break it:
//let sortDescriptor1 = NSSortDescriptor(key: "gameBelongsTo", ascending: true)
let sortDescriptor2 = NSSortDescriptor(key: "date", ascending: true)
fetchRequest.sortDescriptors = [/*sortDescriptor1,*/ sortDescriptor2]
fetchRequest.fetchBatchSize = 20
let fetchedResultsController = NSFetchedResultsController(
fetchRequest: fetchRequest,
managedObjectContext: self.managedObjectContext,
sectionNameKeyPath: nil, //"gameBelongsTo.name",
cacheName: nil)
I should add the date
is an attribute on the Game model. but the gameBelongsTo
is a relation. That is from the Game and relates to the Team that this game is associated with.
This is the error I am getting, which is confusing me. Any help would be greatly appreciated
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: unrecognized selector sent to instance ***