IOS magical record create new entity and add to array not woking
<p>Hi I'm working with Core Data and Magical Record. After receive JSON response from server. I want to create an entity, update its property and add to and array. </p>

<p>My code is </p>

<pre><code>NSMutableArray *items = [NSMutableArray array];
NSManagedObjectContext *localContext = [NSManagedObjectContext MR_context];
Article *article = [Article MR_createEntityInContext:localContext];
[article setOrderingValue:idx];
[article updateWithApiRepresentation:articleJSON];
[items addObject:article];
</code></pre>

<p>I dont know why the above is not working (does not return correct items array). It's only work if I replace this line</p>

<pre><code>Article *article = [Article MR_createEntityInContext:localContext];
</code></pre>

<p>with this line</p>

<pre><code>Article *article = [[Article alloc] initWithEntity:[Article entityInManagedObjectContext:localContext] insertIntoManagedObjectContext:nil];
</code></pre>

<p>The main purpose is to return correct <code>items</code> array. Any help is much appreciate. Thanks </p>