Open Google Maps App in iOS 6 - iphone

I would like to open Google Map App in iOS 6 programmatically.
I tried to open the maps in by passing url - maps.....
but it is still opening in the Safari

[[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:#"comgooglemaps://"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
#"comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic"]];
reference: https://developers.google.com/maps/documentation/ios/urlscheme

try this
The domain must be maps.apple.com.
A parameter cannot be q=* if the value is a URL (so KML is not picked up).
The parameters cannot include view=text or dirflg=r.
https://developer.apple.com/library/safari/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html#//apple_ref/doc/uid/TP40007894-SW1

Related

Open Settings → Wifi from alert button action in iOS 5.1

I want to open Settings from my app's alertView button action with following URL Scheme.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General&path=Network"]];
It's working fine for iOS 5.0 but not for 5.1 and above.
Any alternate way to implement this?
Simply no. This URL scheme has been disabled by Apple in SDK 5.1. Its not possible without Jailbreak.
This feature is no more supported in iOS 5.1 and above. No direct way to do this.

Open Twitter app in html

Is there anyway to open the twitter app from an html link on an iPhone? Kind of how when you click a youtube link it goes to the youtube app.
thanks
You'd use twitter:// as the URL and put it in an action for a button or something like so:
-(IBAction)openTwitter{
NSURL* url = [NSURL URLWithString:#"twitter://"];
[[UIApplication sharedApplication] openURL:url];
}
If you meant html on a website you'd use tap me to go to twitter for the link.
URL Schemes are shown here and you can grab some more handy information about them too.
I'd probably recommend #Arab_Geek's solution though as it isn't that much of a trouble and it's giving back control to the user.
Why don't you use Twitter integratation for iOS 5 (TWTweetComposeViewController) ?
NSURL * twitterURL = [NSURL URLWithString:#"twitter://"];
if([[UIApplication sharedApplication] canOpenURL:twitterURL])
[[UIApplication sharedApplication] openURL:twitterURL];

Navigate to settings screen in iphone

I want to move from my app to settings screen of iphone when a button in the app is pressed. Can any one please help by telling how to do it? Any help is appreciated. Sorry for my bad english.
Thanks
prefs:root=General pattern no longer works for iOS Latest versions !!!
There is an update in it. The following works fine in iOS 8 ..
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]];
you may look at this
iOS Launching Settings -> Restrictions URL Scheme
Settings screen can be opened for versions less than IOS 5.0 as it has been disabled for latest IOS's. For Lower versions you can try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
MoreOver you should create your own view and present the editable settings to the user and get the input from him(for the first time or as a menu) and store it using NSUserdefaults.
You can't ask user to enter settings such as server-address port etc and try it each time, if it works.
I have found a solution for navigating from your application to Settings application which works fine iOS 8 or later versions
1) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
This will navigate to settings only if your app settings are absent
if they are present then the above code will navigate to Settings page of your app
I am using the below string to navigate to iCloud page and it works fine
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"App-Prefs:root=CASTLE"] options:#{} completionHandler:nil]
just by replacing the "CASTLE" with "GENERAL"

How to make link open "Maps" window when clicked

I would like to have a link in a web page in such a way that when the link is clicked it opens the standard "Maps" view in iPhone.
If such a thing is possible, what tag format do I need to use with the link?
It's pretty simple; you don't even need to use a specific scheme identifier. Any Google Maps URL will be opened with the Maps app automatically, as long as all the parameters are supported.
So links like these:
http://maps.google.com/maps?q=cupertino
http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino
Would automatically be opened in Maps. To find out more about what works and what doesn't see the Map Links page from the Apple URL Scheme Reference.
I used this code which works passing longitude lattitude:
NSString *url = [NSString stringWithFormat: #"http://maps.google.com/maps?saddr=%f,%f&daddr=%#",cur_lat, cur_lon,[loc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSLog(#"current %f %f",cur_lat,cur_lon);
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:url]];

iPhone: Opening Application Preferences Panel From App

Is it possible to open the application's preferences pane directly from the app, or will users be forced to to go through the Settings app?
The nicer alternative is to use InAppSettingsKit which does the replication for you. Apple wants everybody to use the Settings app though.
You can use this on iOS 5.0 - 5.0.1.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
It is possible now in iOS 8
if (&UIApplicationOpenSettingsURLString != NULL)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
They have to go through the Settings app.
An alternative is for you to replicate the settings within your application.