I want to enter a password in a webpage I load in an UIWebView. The password is a string, and I want to enter the password and hit a button in the page, automatically when the View loads.
Any help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re using a UIWebView, I assume you’re loading some web service into that WebView. Why not build your login system into the web service? You could even just use HTTP Basic Auth.
If you’re managing the passwords within your cocoa app, then I would probably implement a UIAlertView with a UITextField asking for the password. When the user presses Login you can validate the password and then load your web service in your UIWebView.
If you’re managing the passwords in a database on the website then you’d build an html/js/php/mysql login form and load it in the UIWebView first.
Update
I’d go with the first option and display your own login form using cocoa controls like the UIAlertView with 2 UITextFields. You can then save the username and password using the keychain services and submit them every time the users launches the app or the web session expires.
If you want to try this method I’d suggest having a look at the ASIHTTPRequest framework. In particular ASIFormDataRequest which let’s you easily send a form with the correct fields.