Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save Any Unsaved PFObject Even User Terminate the App

I am creating a social network app where user can create groups, post pictures, update pictures. etc

The problem I am experiencing is that sometimes, during the process of saving data to Parse, user can terminate the app.

I am wondering if there is any workaround this problem? Is there anyway I can get retrieve any Unsaved PFObjects and save them?

like image 716
JayVDiyk Avatar asked Oct 19 '22 09:10

JayVDiyk


1 Answers

Is saveEventually good enough for you?

The advantage is that if the user currently doesn't have a network connection, saveEventually will store the update on the device until a network connection is re-established. If your app is closed before the connection is back, Parse will try again the next time the app is opened.

PFObject *gameScore = [PFObject objectWithClassName:@"GameScore"];
gameScore[@"score"] = @1337;
gameScore[@"playerName"] = @"Sean Plott";
gameScore[@"cheatMode"] = @NO;
[gameScore saveEventually];

Or you can declare your app’s supported background tasks, so when your app is not in foreground, you can still upload (or download) data.

like image 141
iForests Avatar answered Oct 22 '22 00:10

iForests