应用程序崩溃使用Parse本地数据存储区

时间:2015-01-23 14:36:48

标签: ios iphone parse-platform

我开发了一个使用Parse本地商店的应用程序,因为大多数时候使用它的人没有互联网连接我的行为非常基本我只保存数据然后将其发送到解析(当他们有连接时),大部分时间这种方法很好,但有时当他们要打开应用程序时,它会突然最小化。

测试应用程序我发现当发生这种情况时会发生此错误:

[__ NSCFDictionary fetchFromLocalDatastoreInBackground]:无法识别的选择器发送到实例xxxxxxx。

我的问题是:有没有人有关于如何解决这个问题的想法?

更新

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

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];


//Extras
theObject[@"ValorTotal"] = [NSString stringWithFormat:@"%d",facade.total];
theObject[@"RiesgoTotal"] = [self getTotalRisk];
if (facade.internationalNA)
{
    theObject[@"VueloInternacional"] = [NSString stringWithFormat:@"%@",@"NO"];
}
else
{
    theObject[@"VueloInternacional"] = [NSString stringWithFormat:@"%@",@"SI"];
}

[theObject saveEventually];

即时通讯使用此代码保存多个请求,然后当互联网来到ipad时,请求"保存"。

1 个答案:

答案 0 :(得分:0)

错误本身的起源是因为存储在数据存储区中的许多请求存在,并且应用程序因内存问题而崩溃导致此错误。

另一方面,我的解决方案是我鼓励我的用户在没有互联网的情况下保存他们想要的任何内容,但确保当天的最后一次保存是通过互联网连接完成的,这显然会立即发送所有存储的数据。