Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Is it possible to open NSURLRequest directly in Safari?

I'm not talking about a UIWebView, I want to open the mobile safari app using an NSURLRequest.

Why? In my app, the user has already logged into our web server. I want to give the user the option of launching the webpage without having to reenter their credentials. However, I can't use a GET because that would put their credentials in the URL.

So, can I open the safari app (not a UIWebView) from my app with an NSURLRequest or a POST in some other form?

like image 670
mtmurdock Avatar asked Mar 26 '12 22:03

mtmurdock


1 Answers

I'm going to put my neck on the line and say no — there's no way to pass an NSURLRequest directly to Safari. The (primary) inter-application communication medium on iOS is to access URLs; there's no general mechanism for passing objects from one application to another.

I think the best you're going to be able to do is to fetch a one-time key from your web server in the app, then pop into Safari with that in the URL. And, if you can, do that via HTTPS so that the URL path and query components are only visible once TLS negotiation has succeeded. That should stop anybody else from seeing the relevant credentials and stop them from being useful even if they're obtained by some other means (such as somebody next to you copying the URL from your screen).

like image 186
2 revs, 2 users 56% Avatar answered Oct 15 '22 03:10

2 revs, 2 users 56%