launch browser(safari)inside my app - iphone

I have the following code
NSURL *url = [NSURL URLWithString:#"workingUrl"];
[[UIApplication sharedApplication] openURL:url];
which currently loads the url correctly but when the user is done, they have to exit and go back into my app.
How can the browser be loaded from within my app?
Regards

You have to make a little browser yourself. Create a View Controller with a UIWebView and some buttons that tigger it's methods (forward, back, reload, etc).

Related

How to control unwanted Pop-up that appear when making call within app

I am developing an app about making call and returning to app when calling ended. Here is my code;
**callWebview = [[UIWebView alloc] init];
NSURL *telUrl=[NSURL URLWithString:#"tel:4444484"];
[callWebview loadRequest:[NSURLRequest requestWithURL:telUrl]];**
This is ok but when url request is being sent, A pop up appears on the screen.
This is the screenshot when I press the button and run the code at upside;
So , Here is my question;
Can I block this pop up to appear on the screen ?
If I can't how can I change the message body and buttons of this popup ?
Thanks...
If you do not use the UIWebView the message will not appear, but then you will not be able to come beck to the app.
To make a call with out the alert:
NSURL *telUrl=[NSURL URLWithString:#"tel:4444484"];
// Check if the iOS device support dialing a number
if ( [[UIApplication sharedApplication] canOpenURL:telUrl]) {
[[UIApplication sharedApplication] openURL:telUrl];
}
But there is no solution that will do exactly what you desire, so either it is the dialog or no dialog but not retuning to you app.
Try the following instead:
NSURL *telUrl=[NSURL URLWithString:#"tel:4444484"];
[[UIApplication sharedApplication] openURL:telUrl];

Make Safari Browser appear in iPad/iPhone App

I have an app that I am in the process of writing and I want too have a button on the screen that the user can press to go to a web page in safari. I do not want to use the UIWebView control and make my own browser, I just want the screen to switch to Safari.
Can any give me some tips how to do this?
You should be able to do it with this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.google.com"]];

Open web browser on launch of App

I need to know how to have an iphone app do nothing but open the web browser as soon as it starts. I know the code needed to open a broswer.. its
NSURL *url = [NSURL URLWithString:#"http://www.google.com"];
[[UIApplication sharedApplication] openURL:url];
My problem is I don't know where to put this code. Ive tried putting it in main.m but it either errors or does nothing. I'd like to avoid needing to use a button. I'd prefer it be automatic as soon as the app is launched. I also need to image this to a HDMI TV and once again, I know the code for this.. I just don't know where it should be put, as I also want it to begin as soon as the app is started.
Thanks.
If you plan to submit this app to the App Store I've got bad news for you, Apple will reject your app if all it does is open a website.
But back to your question place the code in app delegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSURL *url = [NSURL URLWithString:#"http://www.google.com"];
[[UIApplication sharedApplication] openURL:url];
}

Open WebView in Safari

Can someone tell me how I can make an IBAction that opens the current link in the WebView in Safari.
So ​​that all pages I open that WebView can be opened with that one button in Safari.
Thanks.
- (IBAction)openLink {
NSURL * currentURL = [myWebView.request URL];
[[UIApplication sharedApplication] openURL:currentURL];
}
This should mostly work for URLs loaded via loadRequest: or traversed from there but won't work for other local load methods like loadHTMLString:baseURL:

Restarting iPhone application after [UIApplication sharedApplication] openURL

As title says I'd like to know how to restart my iPhone app after doing this:
[[UIApplication sharedApplication] openURL:[NSURL UrlWithString:#"tel://0123456789"]]
It seems pretty simple as I saw many topics also talking about restoring the very state of the application when openURL is called, but I can't find how to simply restart the app when the calling is finished.
Is it supposed to be the default behavior? As for me, the iPhone opens Favorites after call is finished, I don't know why.
You can't. Starting an app is solely user's responsibility - which I consider a good thing.
check the discussion here: https://devforums.apple.com/message/128046#128046
create a UIWebView to load the phone url like this:
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[webview loadRequest:[NSURLRequest requestWithURL:url]];
just use
[[UIApplication sharedApplication] openURL:[NSURL UrlWithString:#"telprompt://0123456789"]]
It will return to the app after call finished
You can't restart an app after a phone call, as your app has terminated and your code is no longer being run.
If you want to restart after the user visits a webpage, you can put a link with a custom scheme in that webpage, and register it with your app. The user can then tap the link to open your app again.