1
votes

Im currently developing an application in which the users are offline most of the time, i use parse to save some objects and then send them to parse when online.

im using this code to set up Parse and localstore:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

[ParseCrashReporting enable];
[Parse enableLocalDatastore];
[Parse setApplicationId:@"xxx" clientKey:@"xxx"];

return YES;
}

And revising that both crashing reporting and local datastore are available using this code in my first view controller:

    NSLog(@"PARSE LOCAL DATA STORE IS AVAILABLE %hhd",[Parse isLocalDatastoreEnabled]);
NSLog(@"IS PARSE CRASHREPORTING AVAILABLE %hhd",[ParseCrashReporting isCrashReportingEnabled]);

With this console return

2015-01-25 18:03:41.781 ERAVSearca[4311:2274819] PARSE LOCAL DATA STORE IS AVAILABLE 1
2015-01-25 18:03:41.782 ERAVSearca[4311:2274819] IS PARSE CRASHREPORTING AVAILABLE 1

So all of this was my investigation to know that the method that is not working is save eventually which i call in this code:

PFObject *theObject = [PFObject objectWithClassName:@"ERAV"];

        theObject[@"Piloto"] = facade.ThePilot;
        theObject[@"Copiloto"] = facade.TheCopilot;

        theObject[@"Fecha"] = facade.TheDate;
        theObject[@"Origen"] = facade.TheOrigin;
        theObject[@"Destino"] = facade.TheDestination;
        theObject[@"Matricula"] = facade.TheLicence;
        theObject[@"Hora"] = facade.TheTime;

        //Questions

        theObject[@"Pregunta1"] = [NSString stringWithFormat:@"%d",facade.answer1];
        theObject[@"Pregunta2"] = [NSString stringWithFormat:@"%d",facade.answer2];
        theObject[@"Pregunta3"] = [NSString stringWithFormat:@"%d",facade.answer3];
        theObject[@"Pregunta4"] = [NSString stringWithFormat:@"%d",facade.answer4];
        theObject[@"Pregunta5"] = [NSString stringWithFormat:@"%d",facade.answer5];
        theObject[@"Pregunta6"] = [NSString stringWithFormat:@"%d",facade.answer6];
        theObject[@"Pregunta7"] = [NSString stringWithFormat:@"%d",facade.answer7];
        theObject[@"Pregunta8"] = [NSString stringWithFormat:@"%d",facade.answer8];
        theObject[@"Pregunta9"] = [NSString stringWithFormat:@"%d",facade.answer9];
        theObject[@"Pregunta10"] = [NSString stringWithFormat:@"%d",facade.answer10];
        theObject[@"Pregunta11"] = [NSString stringWithFormat:@"%d",facade.answer11];
        theObject[@"Pregunta12"] = [NSString stringWithFormat:@"%d",facade.answer12];
        theObject[@"Pregunta13"] = [NSString stringWithFormat:@"%d",facade.answer13];
        theObject[@"Pregunta14"] = [NSString stringWithFormat:@"%d",facade.answer14];
        theObject[@"Pregunta15"] = [NSString stringWithFormat:@"%d",facade.answer15];
        theObject[@"Pregunta16"] = [NSString stringWithFormat:@"%d",facade.answer16];
        theObject[@"Pregunta17"] = [NSString stringWithFormat:@"%d",facade.answer17];
        theObject[@"Pregunta18"] = [NSString stringWithFormat:@"%d",facade.answer18];
        theObject[@"Pregunta19"] = [NSString stringWithFormat:@"%d",facade.answer19];
        theObject[@"Pregunta20"] = [NSString stringWithFormat:@"%d",facade.answer20];
        theObject[@"Pregunta21"] = [NSString stringWithFormat:@"%d",facade.answer21];
        theObject[@"Pregunta22"] = [NSString stringWithFormat:@"%d",facade.answer22];
        theObject[@"Pregunta23"] = [NSString stringWithFormat:@"%d",facade.answer23];
        theObject[@"Pregunta24"] = [NSString stringWithFormat:@"%d",facade.answer24];
        theObject[@"Pregunta25"] = [NSString stringWithFormat:@"%d",facade.answer25];
        theObject[@"Pregunta26"] = [NSString stringWithFormat:@"%d",facade.answer26];
        theObject[@"Pregunta27"] = [NSString stringWithFormat:@"%d",facade.answer27];
        theObject[@"Pregunta28"] = [NSString stringWithFormat:@"%d",facade.answer28];
        theObject[@"Pregunta29"] = [NSString stringWithFormat:@"%d",facade.answer29];
        theObject[@"Pregunta30"] = [NSString stringWithFormat:@"%d",facade.answer30];
        theObject[@"Pregunta31"] = [NSString stringWithFormat:@"%d",facade.answer31];
        theObject[@"Pregunta32"] = [NSString stringWithFormat:@"%d",facade.answer32];
        theObject[@"Pregunta33"] = [NSString stringWithFormat:@"%d",facade.answer33];
        theObject[@"Pregunta34"] = [NSString stringWithFormat:@"%d",facade.answer34];
        theObject[@"Pregunta35"] = [NSString stringWithFormat:@"%d",facade.answer35];
        theObject[@"Pregunta36"] = [NSString stringWithFormat:@"%d",facade.answer36];
        theObject[@"Pregunta37"] = [NSString stringWithFormat:@"%d",facade.answer37];
        theObject[@"Pregunta38"] = [NSString stringWithFormat:@"%d",facade.answer38];
        theObject[@"Pregunta39"] = [NSString stringWithFormat:@"%d",facade.answer39];
 [theObject saveEventually];

So my question is does anyone know if parse SaveEventually is not working with SDK v 1.6.2? it was working in SDK 1.6.1 for me

1
Why are you saving eventually both before and after updating your data? - Lyndsey Scott
What do you mean by "not working"? Throwing an error? - picciano
@picciano no data is sent to parse with or without internet - Nicolas Cadena
@NicolasCadena There's no guarantee as to when a save eventually object will eventually be saved... So maybe yours just hasn't saved yet... - Lyndsey Scott

1 Answers

0
votes

My solution is first to saveinbackground if I have connection to internet and saveEventually when there is no connection.

Secondly I encourage my users to save whatever they want without internet but ensure that the last save of the day is done with connection this apparently sends all of the stored data at once.