I have a mobile website that I've had a link to open Google maps app from within my website. Now however with the new version of ios6, the native version of google maps is no more and now the link opens to a safari based google maps. I'd rather have this open in a native Apple maps app. How can I do this?
Thanks for all help!
Instead of using the previous Google domain maps.google.com you use maps.apple.com. This will remain compatible with older devices running 5.x and below.
It looks like this:
http://maps.apple.com/maps?q=cupertino
Most of the parameters are the same, but see the Apple docs for more details:
Apple URL Scheme Reference: Map Links
what do you want ?
open maps web safari or open maps app ?
try this
CLLocation * currentLocation;
NSURL *requestUrl;
CLLocationCoordinate2D storedLocation;
CLLocationCoordinate2D start = { (storedLocation.latitude), (storedLocation.longitude) };
//Bitiş Yeri
CLLocationCoordinate2D end = { ([koordinatX floatValue]), ([koordinatY floatValue]) };
NSString *googleMapsURLString = [NSString stringWithFormat:#"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", start.latitude, start.longitude, end.latitude, end.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];
Related
Im using this code to open AppStore app url , which is working fine am trying to launch then app it self not just open the appstore app page
any tips how i can do this using NSURL
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *appStoreUrl = [NSURL URLWithString:#"https://itunes.apple.com/us/app/cnn-app-for-iphone/id331786748?mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];
});
You can only open the app itself if it supports a custom URL-scheme. Posting from Tweetbot is enabled by opening the url tweetbot:///post?
Alot of pages lists the urls you need to interact with other apps, see for instance http://handleopenurl.com/ or http://wiki.akosma.com/IPhone_URL_Schemes for other examples and apps
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms://itunes.com/apps/appname"]];
I want to have a link to a Google Map on our company mobile website. The problem is, if I make a link, it takes you to the Google Maps website. It needs to open up the app.
I have found out that if you start the url with "comgooglemaps://" it will open google maps. However, this poses the problem that if a iOS user does not have Google Maps installed the link will not work.
Is there a way to open Google Maps if it is installed, but open the browser if not (I don't believe you can open Apple Maps from a website due to the nature of their API)
Thanks
EDIT: Just a heads up, this is being done on a website, not an app. So it needs to be done through HTML, Javascript, PHP etc. NOT a programing language.
Have a look at the Apple Maps Links page.
Basically you link to maps.apple.com and it redirects to Google Maps if needed. Here's an example from the page:
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
With latitude, longitude and zoom:
http://maps.apple.com/?ll=53.01,6.01&z=15
Check this Link
You can use this method with url scheme for google map app. (comgooglemaps://blahblah)
[[UIApplication sharedApplication] canOpenURL:(NSURL*)foo]
It will return BOOL value.
Try this to move google map and set route
NSString* addr = nil;
addr = [NSString stringWithFormat:#"http://maps.google.com/maps?daddr=%1.6f,%1.6f&saddr=Posizione attuale", destinationLat,destinationLong];
NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
Try this code
if ([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:#"comgooglemaps://"]]) {
NSString * url = [NSString stringWithFormat:#"%#%#,%#",#"http://maps.google.com/maps?q=",#"75.14524",#"12.1521"];
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:url]];
}
I'm making an application where i would open Facebook native app from within the app.
That problem i have sold with this
NSString* urlString = #"fb://groups/";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: urlString]];
But if the native app isn't installed it should open Facebook in the native safari app on the iPhone. That is my problem?
Is there anyone that could help me with that?
NSString fbURL = #"fb://group/5385407511";
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:fbURL]];
if(canOpenURL) {
[[UIApplication openURL:[NSURL urlWithString:fbURL]];
} else {
[[UIApplication openURL:#"http://facebook.com"];
}
It's a very bad idea to write your app in a way which relies on Facebook's native app not changing its internal structure, your app could break at any moment.
That said, if you must do this for some reason, you can check if the Facebook app is installed by checking an fb:// URL with UIApplication's
- (BOOL)canOpenURL:(NSURL *)url
On iOS5 is it possible to prompt and direct a user to the Twitter Settings.app area so they can add their twitter account to the phone? If so how do you do it?
As a work around I can direct them to open Settings.app but thats about it.
I just pop a browser if they don't have the twitter account on the device on an app where the budget was not large enough to implement more complex functionality, this may be useful to some people:
if([TWTweetComposeViewController canSendTweet]){
...
}else{
NSString *tweet = [NSString stringWithFormat:#"http://twitter.com/intent/tweet?source=SourceApp&text=%#", [tweetText substringToIndex:140]];
tweet = [tweet stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *webLink = [NSURL URLWithString:tweet];
[[UIApplication sharedApplication] openURL:webLink];
}
I found the solution in another SO Post:
Open Twitter settings in Settings app
Short answer is:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=TWITTER"]];
Tweetsheet did this by itself if tweetsheet found that if there is no account in twitter under setting then it pops an AlertView that will automatically guide user to log in on the native setting for twitter for more refer to this link http://dl.dropbox.com/u/47726728/tweet%20sheet.swf
download this file and open it in jing or drag it on your browser
As noted in a comment here, this is now default behavior in iOS since 5.1. Just open one of those widgets and if the user hasn't input an account into iOS the user will be prompted to do so.
I've seen posts here on Stackoverflow that describe how to allow users to be directed to apps on the app store.
Is there a way to link directly to the rating and comments form in the App Store?
This IS possible using the technique described on this blog:
http://www.memention.com/blog/2009/09/03/Open-Reviews.html
basically you call UIApplication openURL with the following:
NSString* url = [NSString stringWithFormat: #"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%#", myAppID];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
To get your app ID before your app is available in the app store, use iTunesConnect to define your new app - give it a name, description, icon, screenshots, etc. Once defined, you can get the Apple ID from the Identifiers section for the app.
EDIT:
Here is a secondary url/method that works:
NSString* url = [NSString stringWithFormat: #"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%#&pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8", appid];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url ]];
I believe the difference between the two is that the first technique (itms-apps://) will launch the App Store app directly while the second one (http://) will launch it indirectly via a redirect resulting from the http web URL. This would have to be confirmed; this is only my recollection.
Answers here are outdated.
This works on my end (Xcode 5 - iOS 7 - works only on Device, not simulator!):
itms-apps://itunes.apple.com/app/idYOUR_APP_ID
For versions lower than iOS 7 use the old one:
itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=YOUR_APP_ID
Simple method that I am using is;
-(void)rateApp {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[#"itms-apps://itunes.apple.com/app/" stringByAppendingString: #"id547101139"]]]; }
You can also use SKStoreProductViewController as an alternative. It will open the store in your app. You may like it better than opening another app, especially on iPads.
Thanks to Ahment swift version:
UIApplication.sharedApplication().openURL(NSURL(string: "itms-apps://itunes.apple.com/app/id951334398")!)