Johnykutty
Johnykutty

Reputation: 12829

How to return to app after openURL

in my app I need to open a url by using

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"urlstring"]];

after a certain process in the page how can i return to the app.(like facebook doing for safari authentication)

Upvotes: 0

Views: 2205

Answers (3)

Charlie S
Charlie S

Reputation: 4594

This might work?

UIWebView webView = [[UIWebView alloc] init]; 
NSURL *url = [NSURL URLWithString:@"urlstring"]; 
[webView loadRequest:[NSURLRequest requestWithURL:url]];

Upvotes: 0

Anshu Chimala
Anshu Chimala

Reputation: 2800

What the Facebook app does is it registers fb:// URLs to redirect to it. Then it sends you to a special link at facebook.com that redirects to an fb:// link while passing some information along (a token or whatever). If you open Safari and type "fb://" into the URL bar you'll get sent to the Facebook app. rckoenes' answer shows how to register URLs to do that, but the part about returning to your app is up to your website (you have to write that redirect page).

Upvotes: 0

rckoenes
rckoenes

Reputation: 69469

You can't unless you also build the website part, then you can open your own app by calling the App custom URL scheme, wich you will have to add your self to info.plist.

Upvotes: 4

Related Questions