Post

Replies

Boosts

Views

Activity

Reply to Preview Crashes when using @FetchRequest
I got this working in a strange roundabout way. Looking through the crash logs, I saw this: ** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.' My FetchRequest was similar to yours: @FetchRequest(entity: Movie.entity(), sortDescriptors: []) var movies: FetchedResults<Movie> Moving fetch request creation to a new static variable and using another @FetchRequest wrapper, it now does not crash: static var getMoviesFetchRequest: NSFetchRequest<Movie> {         let request: NSFetchRequest<Movie> = Movie.fetchRequest()         request.sortDescriptors = []         return request    } @FetchRequest(fetchRequest: getMoviesFetchRequest) var movies: FetchedResults<Movie> And now it works. I am not sure why, but something is going on with the entity not being set. I hope to file a bug report tomorrow with sample code.
Aug ’20