How to return to app after openURL - iphone

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)

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.

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).

This might work?
UIWebView webView = [[UIWebView alloc] init];
NSURL *url = [NSURL URLWithString:#"urlstring"];
[webView loadRequest:[NSURLRequest requestWithURL:url]];

Related

Can I open local file url with Safari by Application::openURL method in ios?

I need to launch a page in my ios app, but want it to be launched outside of my app, because this page will redirect user to a bank page to pay.
I do not have the direct Bank URL on hand, all depends on the redirection action.
I 'd like to open it with Safari outside of my app, in that case, the bank url address will be showed, app user will feel secure.
Embed a bank page in a UIWebview looks not good.
is that possible, how can I do this?
Try this one:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"https://www.mybank.com/?shop=pipco&customer=rdnzl&product=muffin"]];

Force a link to open in Safari instead of the in-app browser

I have an issue with QR Readers.
I encode a URL within a QR Code. When read by many iPhone App they will open the URL within a WebView within the app.
I want to open a vcard there which those internal things just wont do - page stays blank whilst when opened directly in safari everything works great.
So my question is:
Is there any way to get out of the WebView and open the safari?
Regards
Nik
No, there is no way to do this, you are at the mercy of the app creators.
NSURL *url = [NSURL URLWithString:#"http://www.google.com"];
if (![[UIApplication sharedApplication] openURL:url])
NSLog(#"%#%#",#"Failed to open url:",[url description]);
While I agree with #rjstelling... try QRafter by Kerem Erkan - you can choose to open the URL specified in a QR code with either the application's web browser or in Safari.

Anyone know how to open a fb fan page in iphone app from web page?

I'm trying to open my facebook fan page in the fbook app from a web page in safari.
I found
What are all the custom URL schemes supported by the Facebook iPhone app?
and I've tried setting the link to
fb://pages/[pageid]
fb://pages/?id=[pageid]
fb://page/[pageid]
fb://page/?id=[pageid]
fb://profile/[pageid]
They all open the app( of course ) but not at my page,
I feel like i'm close but I've been poking round at it for a while now, any help much appreciated.
To open facebook page in facebook app you should:
1)Find uid of your page (it can be done for example by looking at source code of your facebook page)
I got the following fragment from the source code of the page: http://www.facebook.com/Innova.et.Bella
{"text":"Innova et Bella","type":"ent:page","uid":73728918115}
N.B.: To check if uid is correct substitute uid for pagename: http://www.facebook.com/73728918115
This url should open your page.
2) When the uid is found end is correct use this code:
NSURL *urlApp = [NSURL URLWithString:#"fb://profile/73728918115"];
[[UIApplication sharedApplication] openURL:urlApp];
This code will open you page within facebook app.
N.B.: Do not forget to check if the facebook app exists( or more precisely that the url can be opened) using: if ([[UIApplication sharedApplication] canOpenURL:urlApp]) otherwise open it in Safari.
Facebook tab pages do not displayed in the mobile or app version of facebook. Not possible.

iOS-Facebook connect with UIWebView

I am a beginner in iOS programming. I am trying to build an Facebook app using iOS SDK for facebook. I have downloaded and integrated the facebook SDK with my sample app. I have also created my app id. I am also able to start my app by (after facebook object creation):
[_facebook authorize:#"123456" permissions:_permissions delegate:self];
Here user authorization takes place within the default iphone browser.
After successful user authorization, I am trying to pass a facebook url pointing to a particular person's facebook wall, within a UIWebView. Now the problem that I am facing is that UIWebView opens up the url in which Sign In/Login option is again there, which should not be the case as I have already done the facebook authorization part.
So my question is how to pass the active facebook session within UIWebView, so that the authenticated user can straight away open any facebook url within UIWebView.
Strangely, instead of UIWebView if I use the following code to connect to a facebook url , i am allowed to successfully connect as an authenticated user:
NSString *url = [NSString stringWithFormat:#"http://www.facebook.com/xmarshall123"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: url]];
The above code off course opens the default browser, and that's probably why I am able to connect to the facebook url as an authenticated user.
Please help.

Open a URL from iPhone Application

I want to integrate some links on my iPhone application.
That is when the user touches on the button saying "Yahoo" then Yahoo's page will be opened and then all the functionalities of Yahoo mail has proceeds. How can I do that? I have a bit of idea about NSURL, but not much.
Please help me for that.
Thanks in advance..
To open the page in Mobile Safari, you need to implement something like the following:
NSURL *url = [NSUR URLWithString:#"http://www.google.com"];
[[UIApplication sharedApplication] openURL:url];
You could return to your application using Custom URL Schemes (for more information see the iPhone Application Programming Guide), but since you want to access sites over which you have no control, I presume that isn't an option? Could you use a UIWebView control within your app instead?
In the action method of the target put something like:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.google.com"]];