Skip to content

Strange exception thrown when assigning a value to optional to-one relationship #19

@radianttap

Description

@radianttap

I have a Track and Album entities, where track has optional to-one .album relationship.

@Model class Track: NSManagedObject, Decodable {
	@Relationship(inverse: \Album.tracks)
	var album: Album?
}

@Model class Album: NSManagedObject, Decodable {
	var tracks: Set<Track> = []
}

When I try to assign a value to this album property, I get very strange crash that [Album count] is "unrecognized selector sent to instance". But don't see what could possibly be calling count.

Here's some screenshot of stack frames from the moment exception happens (it's different threads because this is from different attempts - each attempt gives identical frame stack):

Screenshot 2023-10-01 at 14 03 26 Screenshot 2023-10-01 at 17 49 35 Screenshot 2023-10-01 at 17 48 51

Do you have any idea if this could be something in the PersistentModel implementation..?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions