解析SaveEventually不工作的IOS

时间:2015-01-25 23:07:23

标签: ios objective-c parse-platform

我目前正在开发一个大多数时候用户都处于脱机状态的应用程序,我使用解析来保存一些对象,然后在线时将它们发送到解析。

即时使用此代码设置Parse和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;
}

在我的第一个视图控制器中使用此代码修改崩溃报告和本地数据存储区:

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

使用此控制台返回

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

所以这一切都是我的调查,知道最终保存的方法是最终保存,我在这段代码中调用:

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

所以我的问题是,是否有人知道解析SaveEventually是否无法使用SDK v 1.6.2?它在我的SDK 1.6.1中工作

1 个答案:

答案 0 :(得分:0)

我的解决方案是首先保存背景,如果我有连接到互联网并保存,当没有连接时。

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