You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This crash looks like an Automatic Reference Counting issue. ARC is removing PhotoClub or Photographer objects (NSManagedObject in Core Data) that are still being referenced. This is known as "zombie objects".
Observed error messages (listed below)
isTemporaryID seems to be CoreData internal, but is work on behalf of the PhotoClub object.
name is probably PhotoClub.name
givenName_ is Photographer.givenName_
Analysis
This shouldn't with structure (as there are no references with value semantics). And shouldn't happen with normal strong references to objects, but could happen with weak references that may be used internally within Core Data. In particular, this is used to break a cycle between MemberPortfolio which "points to" both a PhotoClub and to a Photographer. While PhotoClub has a computed CoreData attribute called 'members_'; and Photographer has a similar property called memberships_. To avoid this "classical" ARC risk of memory leaks, one of the references is probably weak.
But what to do about it?
pinpoint exactly what is going on using the Zombie detection Instrument in XCode. Doesn't seem to detect this? Which is suspicious.
remove memberships_ and members_ from the data model, hoping that the weak reference no longer exists. This means generating this info ourselves, when needed, using a query to the database. In fact, it may be possible to implement Photographer.memberships and PhotoClub.members as custom computed properties. Core Data however doesn't seem to like relationships without inverse relationships.
carefully add a temporary copy of PhotoClub and Membership to some scope, thus leaving the objects longer. There is actually a keyword for that.
put more permanent references to PhotoClub and Membership objects somewhere (at top level). Essentially trying to deliberately create a memory leak. This isn't too bad if you have say 20 PhotoClub objects with 20 members each: 20 + 400 objects.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PhotoClub isTemporaryID]: unrecognized selector sent to instance 0x2819cdea0'
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCoreDataTaggedObjectID name]: unrecognized selector sent to instance 0x93b50e9d26960d3b'
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCoreDataTaggedObjectID givenName]: unrecognized selector sent to instance 0xb37907d875249736'
This crash looks like an Automatic Reference Counting issue. ARC is removing PhotoClub or Photographer objects (
NSManagedObject
in Core Data) that are still being referenced. This is known as "zombie objects".Observed error messages (listed below)
isTemporaryID
seems to be CoreData internal, but is work on behalf of thePhotoClub
object.name
is probablyPhotoClub.name
givenName_
isPhotographer.givenName_
Analysis
This shouldn't with structure (as there are no references with value semantics). And shouldn't happen with normal
strong
references to objects, but could happen withweak
references that may be used internally within Core Data. In particular, this is used to break a cycle betweenMemberPortfolio
which "points to" both aPhotoClub
and to aPhotographer
. WhilePhotoClub
has a computed CoreData attribute called 'members_'; andPhotographer
has a similar property calledmemberships_
. To avoid this "classical" ARC risk of memory leaks, one of the references is probablyweak
.But what to do about it?
memberships_
andmembers_
from the data model, hoping that the weak reference no longer exists. This means generating this info ourselves, when needed, using a query to the database. In fact, it may be possible to implement Photographer.memberships and PhotoClub.members as custom computed properties. Core Data however doesn't seem to like relationships without inverse relationships.*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PhotoClub isTemporaryID]: unrecognized selector sent to instance 0x2819cdea0'
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCoreDataTaggedObjectID name]: unrecognized selector sent to instance 0x93b50e9d26960d3b'
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCoreDataTaggedObjectID givenName]: unrecognized selector sent to instance 0xb37907d875249736'
https://developer.apple.com/documentation/xcode/investigating-crashes-for-zombie-objects
https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html
The text was updated successfully, but these errors were encountered: