some info:
I made a app that shows some house in a tableview from a website.
If you select one you get a detail view with some info, i added a button to it, when you push it it opens a direct link (into a web view in-app) to “respond” on the website for the house.
The problem:
the first time you push the button, it gives an error = you are not logged in…and returns to a login form, if you login everything works great. If you check another house and push the button again, it remembered the login and you respond instant.
If you get out of the app and open it again, the drill starts from the beginning hehe.
I thought of 2 solutions:
1)
I thought i should make a alerview with the username and password, when you open the app you fill it in and then every time you push the respond button it autofills it. (no idea how to)
2)
Save the cache or something like that so when you come back its like you never left ?
What would be a better option and is there a better way so that the “ugly-way” of pushing the respond button that gives an error-> goes to login-> you login.
Before I begin, I’ll assume that the website you’re showing in the tableview is owned by you and not by a third party, or you have their permission for your application to store usernames/passwords and automatically log in users.
Please keep in mind this is just a general outline, not an implementation – it may be what you do, or just give you other ideas to explore as an eventual solution.
If the idea is to save username and password so the user doesn’t have to keep re-entering it, I’d suggest storing it with your app, separate from the UIWebView stuff (prompting the user for it separately from your app).
Then, when the user is about to go to the webpage for the first time since the app started, you could instead post a request sends your stored login and password (to the same login form the webpage uses), and on success, then load your page. This way, the login page never appears to the end user.
(You’d of course do all of this securely, since you’re dealing with usernames and passwords, and encrypt storage of them…)