• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crash using mutableSetValueForKeys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash using mutableSetValueForKeys


  • Subject: Re: Crash using mutableSetValueForKeys
  • From: "Marcus S. Zarra" <email@hidden>
  • Date: Fri, 9 Feb 2007 08:56:35 -0700

The only thing that catches me right off is this:

[[prefs mutableSetValueForKey:@"languageRelation"] addObject:theLang];
[theLang setValue:prefs forKey:@"prefRelation"];

That seems redundant to me since you have a inverse relationship set
up.  One or the other of these lines would cause the relationship to
be linked both ways.

I do not see anything else right away that would cause an issue.

Marcus S. Zarra
Zarra Studios LLC
Simply Elegant Software for OS X
www.zarrastudios.com

On 2/9/07, Julio Cesar Silva dos Santos <email@hidden> wrote:
Hi,

I have received a crash report from a user of my application
(FetchYourLyrics) that appears to be related to the way I set a
relationship between two entities. The lines of the crash report are:

4   com.apple.CoreData                  0x940d9c88 -[NSManagedObject
(_NSInternalMethods)
_maintainInverseNamed:isToMany:oldDestination:newDestination:] + 164
5   com.apple.CoreData                  0x940da118 -[NSManagedObject
(_NSInternalMethods)
_didChangeValue:forRelationship:named:withInverse:] + 716
6   com.apple.Foundation                0x92a1b648 -[NSObject
(NSKeyValueObserverNotification)
didChangeValueForKey:withSetMutation:usingObjects:] + 696
7   com.apple.CoreData                  0x940d86e4 -[NSManagedObject
didChangeValueForKey:withSetMutation:usingObjects:] + 76
8   com.apple.CoreData                  0x940fc804 -
[_NSNotifyingWrapperMutableSet addObject:] + 148

I have two entities, Preference and SearchLanguage. The entity called
SearchLanguage has a relationship prefRelation with the following
attributes: Optional, Destination: Preference, Inverse:
languageRelation. The entity Preference has a relationship
languageRelation with the attributes: Not Optional, Destination:
SearchLanguage, Inverse: prefRelation.
The first time the application launches, the Preference entity is
created with default values loaded from a dictionary file in the
bundle. The SearchLanguage entity is also on this dictionary so I
create it and add it to the relationship using the following code:

//Create the Preference entity
NSManagedObject * prefs = [NSEntityDescription
insertNewObjectForEntityForName:@"Preference" inManagedObjectContext:
[self managedObjectContext]];
// Add the properties for prefs (not shown because I think it is not
related to the crash)
//Create the SearchLanguage entity
NSManagedObject * theLang = [NSEntityDescription
insertNewObjectForEntityForName:@"SearchLanguage"
inManagedObjectContext:[self managedObjectContext]];
//Add the properties for theLang (also not shown)
//Set the relationships
[[prefs mutableSetValueForKey:@"languageRelation"] addObject:theLang];
[theLang setValue:prefs forKey:@"prefRelation"];

This code works fine for me and apparently for anyone that downloaded
the app so far (at least no one has reported that issue). Is there a
problem with my approach? Can you see a reason for this code not work
for a particular user?

Thanks for any help,

Julio Cesar Silva dos Santos
email@hidden
email@hidden
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Crash using mutableSetValueForKeys (From: Julio Cesar Silva dos Santos <email@hidden>)

  • Prev by Date: Crash using mutableSetValueForKeys
  • Next by Date: Re: Remembering the state of an NSScrollView?
  • Previous by thread: Crash using mutableSetValueForKeys
  • Next by thread: New columns in NSTableView are overridden by plist
  • Index(es):
    • Date
    • Thread