Most of the time, when it comes to commit, an exception will raise in NSManagedObjectContext+Setup.swift, line 97. Am I doing something wrong? I am not sure what.
Originally created by @tomasgibas on GitHub (May 26, 2016).
``` swift
CoreStore.beginAsynchronous { (transaction) in
let bookIds = Array(booksWithRating.keys).map { NumberFormatter.numberFromString($0)!.integerValue }
let books = transaction.fetchAll(From(Book), Where(kBookWithIDsPredicate, bookIds))
books?.forEach({ (book) in
transaction.delete(book.rating)
let rating = transaction.create(Into(Rating))
rating.date = NSDate()
rating.rating = Float(booksWithRating[String(format: "%@", book.bookId!)]!)
book.rating = rating
})
transaction.commit()
}
```
Most of the time, when it comes to commit, an exception will raise in NSManagedObjectContext+Setup.swift, line 97. Am I doing something wrong? I am not sure what.
adam
added the user bug label 2025-12-29 15:23:20 +01:00
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Rating compare:]: unrecognized selector sent to instance 0x12823c5a0'
@tomasgibas commented on GitHub (May 26, 2016):
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Rating compare:]: unrecognized selector sent to instance 0x12823c5a0'
Somewhere in one of your observers, you are using a Rating instance incorrectly. Your hint is there:
'-[Rating compare:]: unrecognized selector sent to instance
Add an exception breakpoint in Xcode and try to reproduce the crash. The breakpoint will stop at the real location of your problem.
This is not a CoreStore issue so I'm closing this ticket.
@JohnEstropia commented on GitHub (May 27, 2016):
Somewhere in one of your observers, you are using a `Rating` instance incorrectly. Your hint is there:
```
'-[Rating compare:]: unrecognized selector sent to instance
```
[Add an exception breakpoint](https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html) in Xcode and try to reproduce the crash. The breakpoint will stop at the real location of your problem.
This is not a CoreStore issue so I'm closing this ticket.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @tomasgibas on GitHub (May 26, 2016).
Most of the time, when it comes to commit, an exception will raise in NSManagedObjectContext+Setup.swift, line 97. Am I doing something wrong? I am not sure what.
@JohnEstropia commented on GitHub (May 26, 2016):
What does the exception message say?
@tomasgibas commented on GitHub (May 26, 2016):
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Rating compare:]: unrecognized selector sent to instance 0x12823c5a0'
@JohnEstropia commented on GitHub (May 27, 2016):
Somewhere in one of your observers, you are using a
Ratinginstance incorrectly. Your hint is there:Add an exception breakpoint in Xcode and try to reproduce the crash. The breakpoint will stop at the real location of your problem.
This is not a CoreStore issue so I'm closing this ticket.