ios - Importing Data using MagicalRecord -
i'm using magicalrecord import data plist. i'm using code less import explained in tutorial importing data made easy.
i have 2 entities manufacturer , car, have 1 many , 1 one relation respectively.
plist structure
this import work fine
nsarray *manufacturers = ... [magicalrecord savewithblock:^(nsmanagedobjectcontext *localcontext) { [manufacturers enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { [manufacturer mr_importfromobject:obj incontext:localcontext]; }]; } completion:^(bool success, nserror *error) { }];
but not getting imported
[magicalrecord savewithblock:^(nsmanagedobjectcontext *localcontext) { [manufacturer mr_importfromarray:manufacturers incontext:localcontext]; } completion:^(bool success, nserror *error) { }];
any explanation highly appreciated.
edit : log of manufacturers array
[ { "cars": [ { "carid": 1, "name": "civic" }, { "carid": 2, "name": "jazz" }, { "carid": 3, "name": "city" } ], "manufacturerid": 1, "name": "honda" } ]
the issue seems bug in magicalrecord, found open bug filed issue.
mr_importfromarray:
using mr_savewithblock:
replacing savewithblockandwait:
solves issue. bug fix