Detecting last value of database after refresh the application - objective-c

I am making an iPad app. I have got some problem. Actually I want to show one view at the starting of the app after launching of splash screen. I have made one checkbox on it. It will work as on/off button. Very first time launching of the app, this screen will show to the user. If user click the off button then this screen will never show to him even after refresfing the app. For it, I have made a database table in which at the starting I have stored 0 value in it. When user click button then it becomes 1. But whenever user will refresh the app it becomes again zero but I want to retrieve the last value from the database. Anyone has idea that how to retrieve last value from database table even after refreshing the app.
Thanks to all.

You really should use user defaults for this purpose. There is a method, registerDefaults that is used to set initial values for a default, but once the user has changed it, that initial value isn't used again on subsequent launches of the app

Related

react-admin pristine state after loading data via dataprovider

I've got an issue due to a timing issue with react-admin, that i'm looking for a little help on.
The situation is where user A creates a resource, and user B, on a different PC, then goes to list and edit that resource.
For user B, the list page loads the full dataset of 10 resources, then the edit page re-loads the single resource that is being edited.
However, the specific process on the edit page seems to be:
Render page
Render resource cached from the list page
Request the single resource from the API
Populate the edit form with the updated values from the API
Set the form to dirty
That last point is critical, since I have an action button that is only enabled if the form is pristine, so the user has to save any changes before triggering the action.
But in this case, the list view and the edit view seem to return the same data for the resource, so I'm not sure why the form is being set to dirty.
Any thoughts?
Regards,
Andy
This isn't a complete answer, but I hope it helps you save some time. I recently upgraded React Admin version from 3.5.3 to 3.6.0. I noticed that the Save button is now sometimes disabled unexpectedly, and inconsistently. For example, I may navigate to the edit view of a resource by clicking a link and the Save button is enabled, but if I refresh the page, the Save button is disabled. Apparently, the Save button is supposed to be disabled when the form is pristine. So between 3.5.3 and 3.6.0, it seems that some changes were made to either the pristine handling or the Save button's reaction to pristine, and it is not working consistently.
I see there is a new issue opened three days ago regarding overriding the Save button behavior, wrt pristine. https://github.com/marmelab/react-admin/issues/4913 . So, it seems the dust hasn't settled on this behavior. Perhaps a bug will be found.

Need prompt to save changes in Windows form when changing displayed record

I am relatively new to programming, so this may be an easy one. I have a Windows form that connects to SQL Server and displays the data in a form where a user can edit and add or delete records (via databinding). The form works well, and has record navigation controls as well as context menus that allow the user to filter data on any field.
Currently, the user can make changes and switch to new records, etc... but changes are not applied until the user clicks the "save" button. However, I'd like to prompt the user to save records whenever the user navigates to a new record (either through navigator or through application of a filter which displays a different record).
What event can I use that will trigger whenever a different record is reflected in the form?
Thanks,
Jay

Multiple forms, keep original input even though form is never used again

in my project I have 3 forms.
On the first form is a textbox which gathers a username, which is then checked against a database and, if confirmed, logs the user into the project.
On the third form, there is a label that displays the username that was entered in the first forms' textbox. When the user is done with a project, they click a button that gives them the choice if they wish to start over...if yes is clicked, they start over from the second form (I don't want them to have to "login" again.
The first general run through the program works fine (first -> second -> third form)...
My problem is, since the first form was closed, never to be seen again, the data that was entered in the first forms' textbox is now gone and the third forms' label just displays "label1"
Is there a way to make it so they user logs in once (the first form) and then continues on about the project (going through the second and third forms over and over again) without having to login again? And having that label KEEP the original "username"?
Thanks to everyone in advance!

What event is triggered whenever the app is dragged back into the current window?

I'm struggling with the activation lifecycle for my app. I just want to save the state for the current page whenever the app is hidden or whenever the user navigates to a different page. Conversely, I want to restore the state whenever the user launches my app or navigates back to that page.
In the following case, I detect that the app was made hidden so I store the page's state, but I never get notified that the app was reactivated so I can restore the state:
(on surface)
1. launch app
2. press start
3. drag app from left edge of screen and drop it back into focus
I was hoping the Resuming event would do it, but no. Which event should I use?
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.application.resuming.aspx
For the whole app, check Window.Activated, for individual pages you can use Page.OnNavigatedFrom / Page.OnNavigatedTo.

Can't retrieve the session on clicking of browser's back button

I have rails application that calculates prices of goods and I set prices in session. I have 'back' button in my application. When I clicks on 'back' link, I will get my previous session values like 'prices','goods' I purchased.
But when I clicks on 'browsers' back button,I won't get my session values, I have to refresh the page for that.
I'd say you have caching issues... The browser remembers what it saw before, and thinks it's the same (without even going to the trouble to ask the server any more). Try if this article helps
You probably want to prevent the browser from caching your pages so that they get refreshed when the user clicks the Back button. This article should help.