Note that there are some explanatory texts on larger screens.

plurals
  1. PONSManagedObject fault / cannot get 'primitive' object handled by NSManagedObject
    primarykey
    data
    text
    <p>I am struggling with CoreData. I'd like to fetch the following object:</p> <pre><code>@interface Email : NSManagedObject { } @property (nonatomic, copy) NSString *email; @property (nonatomic, copy) NSString *contact; @end </code></pre> <p>..and put the result inside a NSMutableArray, but the NSString contents, (not NSManagedObjects!). This is because I am using json-framework and that engine does not allow NSManagedObjects to be passed.</p> <p>These lines fetch perfom the fetch from CoreData</p> <pre><code> NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Emails" inManagedObjectContext:self.managedObjectContext]; [fetchRequest setEntity:entity]; [fetchRequest setPropertiesToFetch:[NSArray arrayWithObject:@"email"]]; NSError *error = nil; NSMutableArray *fetchedObjects = [[NSMutableArray alloc] init]; fetchedObjects= [self.managedObjectContext executeFetchRequest:fetchRequest error:&amp;error]; flight.emails=fetchedObjects; </code></pre> <p>The 'flight' object is declared as follows:</p> <pre><code>@interface Flight : NSObject { NSMutableArray *_emails; } @property (nonatomic, retain) NSMutableArray *emails; </code></pre> <p>With this code I am getting CoreData faults. I tried some other implementation variants, but never actually managed to have NSString objects in flight.emails, but always NSManagedObjects. What I tried was to implement a dedicated getter function in the Email NSManagedObject that copies the fetched NSString and returns the copy. </p> <p>I get the idea that this is kind of a common problem, however, my research has not led to a solution on this one here.</p> <p>Thanks, Peter</p>
    singulars
    1. This table or related slice is empty.
    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.
    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