Does anyone know how to launch a web app from a native app?
I assume that this is hard to achive, but the next best thing would be to launch safari with a specific URL, without the URL-bar. And I don't want it to be done within the app, I would prefer if the native app could go into a suspended state.
It's not hard to achieve, it's easy with UIWebView http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://www.makebetterthings.com/blogs/"]];
and enable multitasking in your app so when the safari opens your app will go in suspended mode.
Update -
Read my these blog entries -
http://www.makebetterthings.com/blogs/iphone/open-phone-sms-email-map-and-browser-apps-in-iphone-sdk/
http://www.makebetterthings.com/blogs/iphone/launching-your-own-application-via-a-custom-url-scheme/
unfortunately you can not open all the apps! but you can add custom URL scheme in your own app to open them
Related
I am new to iOS and I want to know that, How to change the default browser as Google chrome on iPhone Simulator?
Thank you in advance.
As xlc has mentioned the Simulator doesn't allow you to install third party applications. It's designed to let you test your code and how it interacts with iOS.
You cannot change default iOS default browser unless and until your device is jailbroken.
but you can open links in google chrome from your app using :
[[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:#"googlechrome://http://www.nameofwebsitehere.com"]];
Note : this will not work on simulator and you should add a check to see if Google chrome is installed on device.
I am trying to use a URL to launch the native maps application. My build is for 3.1.3 and later. When I run the following code, safari launches with the URL instead of google maps:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://maps.google.com/maps"]];
Any suggestions?
Thanks!
It sounds to me like you are running on the simulator not hardware. This behavior occurs when the map app is not installed or if you are on the simulator.
If you are running on hardware - have you tried that same style with a specific query or location or with http://maps.google.com as the documentation you pointed to mentions that The path cannot be /maps/*. - I'm not sure if that means explicitly *. or if they mean a wildcard. I'm not really clear why you'd want to launch the map app without a specific query.
Your string needs to be #"maps://maps.google.com/...". That "maps" at the front of it is what triggers it to load the Maps.app application.
Is it possible to open another app, like Camera, from a third-party app? I know there are URL schemes - http://wiki.akosma.com/IPhone_URL_Schemes - but I just want to open an app, not send any data to the app.
Unfortunately, no. Launch Services is private API on the iPhone. You application can launch another app only through trying to open a URL registered by that app or a file document the app understands. However, as far as I know, your app has no control over or knowledge about which app exactly will handle the URL or the file.
One way to fire up the camera from within your app, of course, is the UIImagePickerController class.
http://developer.apple.com/iphone/library/documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
It's not quite what you're asking, but it might be as close as you're going to get.
Is it possible to launch the "Photos" application from an iPhone app? Similar to launching mail?
[[UIApplication sharedApplication] openURL:url];
The Photos app doesn't appear to register any URL schemes that other apps can use. There's a pretty well-established pattern in other system apps (e.g. Safari) of “saving an image” resulting in that image being placed in the user's camera roll; I'd recommend just sticking with that expected behavior, and perhaps using an alert to direct the user to look there for your app's exported image.
This article looks like it might be useful?
Getting images from the iPhone
Is it possible to write a function in an iphone app A that when you click on a button within that app A it will close app A and automaticall open up App B
Take a look at Custom URL schemes.
Nice tutorial here http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html