Saving User Information with Parse on different View Controllers - ios

I was wondering if anybody knows how to save data to the same User on Parse by entering information on different ViewControllers? I would like for the user to be able to Sign-Up on 1 View Controller, then answer some questions on the next ViewController, and having all the information be saved under that user? Thanks.

There are many ways to do that, depends on what approach of saving information you are going with. If you just want to pass values from the first view controller to the second one, then it is very simple.
One example of how to do it is here:
http://www.infragistics.com/community/blogs/torrey-betts/archive/2014/05/29/passing-data-between-view-controllers-ios-obj-c.aspx
UPDATE:
Keep in mind that with that approach you won't have any saved data... In order to save it properly, I would suggest to use SQLite or some database to manage users data.

Related

(Rails) Adding new model with initial data to existing app

I've an existing web app that is running in production with user data and various other types of data. I want to add a new model with some initial data for the same.
The data should be there when it goes live. This new data is a one time thing and I don't ever want it to be put back into the database in the future.
I couldn't find an answer to this specific scenario that I have. What is the best way to do this?
Thanks!

pass object back or pull from firebase

I have a situation where I am creating and saving objects to firebase. These can then be edited, and viewed in multiple places, or in multiple viewControllers.
I cannot decide if it is best to continually pass the whole object back and forth, so that when it is changed each view will get the most recent version.
Or, to only pass a little reference to it, or some way that each view knows which one it is dealing with, then have each view just download the most recent version from Firebase...
So central location for up/down from firebase, and pass the object locally around the App.
Or pass some reference around, and have each View up/down/observe with Firebase to stay up to date.
Does this make sense? Sorry for a very conceptual question and thank you for any input!

Ruby on Rails: Two views, one save buffer

Just a note before you read this, I'm not a programmer in RoR but I just wanted to validate that this is possible, so sorry in advance.
I have a quick question about using a secondary page. Here's how I want it to work:
I have a primary page that has some data that will be saved. I have a link to a secondary page that you save only to the buffer. This means that if I change it three times everytime i go back to look at it it shows the last value I changed it to.
At save time of the primary page, I want the information on the primary page and the secondary page to be validated and saved. If it fails, I don't want to save the information on either page. Is this possible in RoR? If so can someone explain to me how?
You could do this in a few ways:
Have one real page, but use JavaScript to hide and show parts of it as needed.
Store the object in the session, and only write it to the database at the end
Store the data in a temporary table and save it in the real table at the end

Use of singleton class and sqlite

Im new to objective-c and I've been reading up on singleton classes. I want to implement it into my logic but im not sure if its correct/possible/doable to do so, any advise would be appreciated.
At the moment i'm loading data from an xml feed, but i want to have control what data should be displayed based on which button is clicked. For example, buttonA would display IT news and buttonB would display celebrity news.
My thinking is to load the xml data into sqlite on application start in the background and display my buttons view at the same time using the singleton class. If the user pushes the button it will query the required table and display the content into a tableView.
Is this viable? If not, could you please advise whats the best way to go about this?
Thank you.
First of all you should reconsider organization of your data model. You've named sqlite on one hand and a global array on the other.
I would point you to Core Data to store your parsed data in a convenient way. Finally all you need is to query the Core Data db and fetch what you need. This would be more memory efficient than storing your data in a global array.
Have a look at Apple's Core Data tutorial or at this nice turorial: "superdb-core-data-app-with-sections"
To share a managed object context you can use a singleton. Have a look at this blog post, it provides a solution without a singleton by passing references of the managed object context down the relevant objects. It is created in the app delegate.

Keep some information between different "new" forms

I have a form where the user can choose options from a lot of select boxes. The form is used to register several items from an RSS feed. The user fills in the form, clicks create and is presented with the same form for the next item in the list.
Sometimes, the same options are valid for several items in the list, and I would like to be able to save some of the selections done so the user doesn't have to make the same selection for the next items.
What is the best way of doing this? I've identified four ways of doing it:
Sessions
Just keep the values in the session hash. This will of course work and is very simple, but I have some undefined feeling that it is a bad idea. It will also not work if the user is using the form from different tabs in the browser.
Cookies
Basically the same as keeping them in the session, I think.
Profile
Can't be done in this case I believe, since profiles are shared between several users.
Database
The most complex way I've come up with is to keep the information in the database and use a query parameter to keep track of which information should be used. This is probably overkill, but in some ways the best way to me. I don't like the idea of keeping this kind of state in session or cookies.
Am I missing some way? Or something?
If after filling first form, some data is saved to db (object is created) then you can use this data from db to fill up new form.
If after filling first form, nothing is saved to db, then you can create in memory some objects based on params from previous post and based on this (on just on params) you can prepare new form. But of course data from previous form should be added as hidden fields in second form.

Resources