Learn Courses My Dashboard

Core Data - replacing Xcode generated extensions

Trying to make this net. I have a data model which has a Entity - Match, and an Entity - Scores.
Early on in the dev process, I made the model with an array of scores, instead of just using the relationship.

Subsequently, changed the model for entities to use relationship and totally makes more sense, I now have two extensions with the same name -

have tried commenting out the second two, btw, boardsPlayed was more than likely the name of the array attribute I originally tried to just stick in the Match entity.

I have been messing with this for 3 days, cannot find out how to successfully delete the data model and recreate it. Tried deleting the Build Folder and regenerating the code.

The error I have been getting for three days is
" unrecognized selector sent to instance "

=================================== code follows
// MARK: Generated accessors for boardsPlayed
extension Match {

@objc(addBoardsPlayedObject:)
@NSManaged public func addToBoardsPlayed(_ value: Scores)

@objc(removeBoardsPlayedObject:)
@NSManaged public func removeFromBoardsPlayed(_ value: Scores)

// @objc(addBoardsPlayed:)
//@NSManaged public func addToBoardsPlayed(_ values: NSSet)

// @objc(removeBoardsPlayed:)
// @NSManaged public func removeFromBoardsPlayed(_ values: NSSet)

}

PS, the error occurs when I try to assign a value to the attributes of the entity scores.
so score.scoreID = UUID as an example.

it should be fine just to delete the old one… also make sure its not part of the bundle/files anymore

or stuff might have been to jumbled up on the backend now so it might be best to just create the project again, most of the code should be easily copy pasted by now though so it won’t take too long (might be faster than messing with it for 3 days)

1 Like

Francis, THANKS SO MUCH for replying. That is exactly what I did and now it is getting the same error code on two of the 20 attributes in the entity, but if I comment out those two, the rest of it runs as expected, so now I’m just searching for what could be the issue. If you have any ideas, let me know.

My biggest issue with Xcode is that so many times, the error code it gives might not be really relevant.

At this point though, I am dealing with a sort of clean copy, so am happier with that.

Thanks again for your reply.

hmm it if works with some attributes then its probably a parsing error… like maybe some parts of the data are “null” or empty for that attribute… or theres a spelling mistake or something that simple

is your data from a json file or something? i suggest try experimenting with it like just taking a few samples or even just one full sample/row and test it out until it goes through