Note that there are some explanatory texts on larger screens.

plurals
  1. POApp crashes with one attribute of core data
    primarykey
    data
    text
    <p>I have a pretty weird problem. I'm using coredata to save notes. I can access/save/edit all the attributes of the "Notes" entity, besides one : category. </p> <pre><code>-(void)editCategory { NSFetchRequest *request = [[NSFetchRequest alloc]init]; NSEntityDescription *categRequest = [NSEntityDescription entityForName:@"Notes" inManagedObjectContext:_managedObjectContext]; request.predicate = [NSPredicate predicateWithFormat:@"text = %@", noteToEdit]; [request setEntity:categRequest]; //Error handling NSError *error = nil; NSMutableArray *mutableFetchResults = [[_managedObjectContext executeFetchRequest:request error:&amp;error]mutableCopy]; if (mutableFetchResults == nil) { NSLog(@"Error happened : %@", error); } Notes *editMe = [mutableFetchResults objectAtIndex:0]; [editMe setCategory:editCategoryText]; NSLog(@"Category from pickerview : %@", editCategoryText); if (![_managedObjectContext save:&amp;error]) { NSLog(@"couldnt save : %@", error); } } </code></pre> <p>This line : </p> <pre><code>[editMe setCategory:editCategoryText]; </code></pre> <p>is crashing. editCategoryText is a string, as the category attribute. The weird thing is that I'm using the exact same piece of code to change the title attribute, and I don't have any problem. </p> <p>Log file :</p> <pre> 2013-11-07 15:49:20.286 Simple Notes 1[16511:a0b] -[__NSCFString managedObjectContext]: unrecognized selector sent to instance 0x8dccc30 2013-11-07 15:49:20.293 Simple Notes 1[16511:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString managedObjectContext]: unrecognized selector sent to instance 0x8dccc30' </pre> <p>Do you have any idea why this attribute is behaving differently from the others ? Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload