iOS How do I navigate my app from inside a UIWebView?

hackrabbit

macrumors newbie
Original poster
Jul 14, 2011
1
0
Here is my problem that I've been trying to figure out for a week now, so any help would be unbelievably appreciated:

I have made a login screen in html that is hosted on my server that authenticates users and redirects them to their profile page. I am opening up that webpage (just a username/ password field and a login button) in a UIWebView in my iPhone app. I want to have the login button redirect to the menu in my app instead of redirecting to another webpage. How can I do this? Cheers!
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
I have one idea (untested, but theoretically sound). Set up a delegate for your UIWebView and handle webView:shouldStartLoadWithRequest:navigationType:. In that, if the request is for the profile page, transition to your menu instead.

The usual way to do this is to present a login UI instead of load a login webpage. From the login UI, you programmatically make a login HTTP request to your reserve, and then process the response. This recent thread discusses how to send a POST HTTP request.
 
Comment

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Or you create webservices, which post back XML/JSON, so you can parse it in a login page. which will save you more headeaches I think.
Save the user as a Singleton user, so u can acces it anywhere (it's info etc.)
 
Comment

Similar threads

Register on MacRumors! This sidebar will go away, and you'll see fewer ads.