Sto usando Magico: https://github.com/magicalpanda/MagicalRecordmagico Record non risparmiando
Sto cercando di salvare i record che ottengo il dal mio sito web al database SqlLite utilizzando Magico e Core Data, ma io continuo a ricevere l'errore:
MR_saveWithErrorCallback:](0xaaa6bd0) NO CHANGES IN CONTEXT <NSManagedObjectContext (0xaaa6bd0): *** BACKGROUND SAVING (ROOT) ***> on *** BACKGROUND THREAD *** - NOT SAVING
Ecco il codice:
for(int i = 0; i < count; i += 1)
{
// results = array of all services from site
NSDictionary * result = [results objectAtIndex: i];
NSNumber * sid = @([[result objectForKey: @"id"] intValue]);
NSNumber * parent = @([[result objectForKey: @"parent"] intValue]);
Service * service = [Service createEntity];
NSString * image = [NSString stringWithFormat: @"%@", [result objectForKey: @"image"]];
NSString * name = [NSString stringWithFormat: @"%@", [result objectForKey: @"name"]];
NSString * machine_name = [NSString stringWithFormat: @"%@", [result objectForKey: @"machine_name"]];
[service setDate: [NSDate date]];
[service setSid: sid];
[service setName: name];
[service setImage: image];
[service setParent: parent];
[service setMachine_name: machine_name];
[[NSManagedObjectContext defaultContext] saveNestedContexts];