简体   繁体   中英

Saving Data With Parse, Existing Project

I built a couple of view controllers already before adding parse to my app.

In VC 1, I have an array of Collection View objects which contain an Image, a Name and a few Buttons.

In VC 2, I am able to add a new Object to the array. After Clicking the Collection View Object with DidselectItemAtIndexPath , It takes me back to my VC 2 where I can now Edit and Delete the Object if need be.

Also, I am able to save the objects locally on the device (or in this case the simulator) with methods that use archiver/unarchiver, decode and encode etc... This way when I open and close the app all of my changes are saved.

My Question Is:

Will wanting to save these objects on parse per particular user require me to delete all of the code I have already added in for saving locally?

User 1: 14 objects

User 2: 11 objects

User 3: 18 objects

This way when I log in depending on the user it will only show that person's objects.

Do I have to delete the code to save locally? How about the code I added, to Add, Edit and Delete these objects?

Thank you.

Yes, the code for saving locally can't be reused for Parse.

You will have to use Parse SDK and its PFObject (or PFObject subclass) to store, edit, delete object on Parse. It is the same when code for NSUserDefaults can't be used for CoreData, they are 2 very different thing.

For saving objects per user, you will need a pointer to the owner (in this case PFUser) in your PFObject when adding - so that later you can query the correct objects belong to that user, then edit or delete them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM