飛豬機(jī)票預(yù)訂:https://h5.m.taobao.com/trip/flight/search/index.html?spm=181.7474825.1998613473.1&ttid=&_preProjVer=0.1.69&_projVer=1.1.40
飛豬火車票/汽車票預(yù)訂:https://h5.m.taobao.com/trip/train/search/index.html?_projVer=0.5.62
美團(tuán)購(gòu)買/搜索:http://i.meituan.com/s/liupanshui- 加上要搜索商品的名稱
淘寶購(gòu)買/搜索:https://s.m.taobao.com/h5?event_submit_do_new_search_auction=1&_input_charset=utf-8&q=? 等于后面加上需要搜索商品的名稱
中國(guó)天氣網(wǎng):http://wx.weather.com.cn/mweather/101260801.shtml#1
微信公眾號(hào)鏈接:mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIzMTQ2NTEyNA==&scene=23#wechat_redirect(可將biz改為自己的openid)
撥打電話
1,這種方法豁鲤,撥打完電話回不到原來的應(yīng)用秽誊,會(huì)停留在通訊錄里,而且是直接撥打琳骡,不彈出提示
NSMutableString*
str=[[NSMutableStringalloc]initWithFormat:@"tel:%@",@"186xxxx6979"];
//NSLog(@"str======%@",str);[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
2锅论,這種方法,打完電話后還會(huì)回到原來的程序楣号,也會(huì)彈出提示最易,推薦這種
NSMutableString*
str=[[NSMutableStringalloc]initWithFormat:@"tel:%@",@"186xxxx6979"];UIWebView* callWebview = [[UIWebViewalloc]init];
[callWebviewloadRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:str]]];
[self.viewaddSubview:callWebview];
3,這種方法也會(huì)回去到原來的程序里(注意這里的telprompt),也會(huì)彈出提示
NSMutableString*
str=[[NSMutableStringalloc]initWithFormat:@"telprompt://%@",@"186xxxx6979"];//NSLog(@"str======%@",str);[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:str]];
//地圖第三方
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
//高德
[alertController addAction:[UIAlertAction actionWithTitle:@"高德地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSString *stringUrl = [[NSString stringWithFormat:@"iosamap://path?sourceApplication=%@&backScheme=%@&sname=%@&dname=%@&dev=0&m=0&sid=BGVIS1&did=BGVIS2&dlat=%lf&dlon=%lf",@"APP名稱", @"iosamap", @"我的位置",_locationTitle,_latitude, _longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:stringUrl]];
}]];
//百度
[alertController addAction:[UIAlertAction actionWithTitle:@"百度地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"百度");
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]]) {
NSMutableDictionary *baiduMapDic = [NSMutableDictionary dictionary];
baiduMapDic[@"title"] = @"百度地圖";
NSString *stringUrl = [[NSString stringWithFormat:@"baidumap://map/direction?origin={{我的位置}}&destination=latlng:%f,%f|name=北京&mode=driving&coord_type=gcj02",_latitude,_longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
baiduMapDic[@"url"] = stringUrl;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:stringUrl]];
//??????????? [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:stringUrl]];
}
}]];
//騰訊地圖
[alertController addAction:[UIAlertAction actionWithTitle:@"騰訊地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSString *stringUrl =[[NSString stringWithFormat:@"qqmap://map/routeplan?type=drive&from=我的位置&to=%@&tocoord=%lf,%lf&policy=1&referer=tengxun",_locationTitle,_latitude,_longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:stringUrl]];
}]];
[alertController addAction: [UIAlertAction actionWithTitle: @"取消" style: UIAlertActionStyleCancel handler:nil]];
[self presentViewController:alertController animated:NO completion:nil];
以下來自:http://blog.csdn.net/ruglcc/article/details/52022592
轉(zhuǎn)載請(qǐng)注明出處
蘋果地圖不需要炫狱,因?yàn)樗翘O果地圖啊藻懒,這樣也好,能保證沒有安裝其他地圖app视译,至少還有一個(gè)蘋果地圖嬉荆,而且蘋果地圖在IOS9也做的越來越好了,本身API提供了一個(gè)跳轉(zhuǎn)打開方法酷含。
這里插入一個(gè)小細(xì)節(jié)鄙早,在IOS9之后,蘋果進(jìn)一步完善了安全機(jī)制椅亚,必須在plist里面設(shè)置url scheme白名單限番,不然無法打開對(duì)應(yīng)的應(yīng)用
#pragma?mark?-?導(dǎo)航方法
-?(NSArray*)getInstalledMapAppWithEndLocation:(CLLocationCoordinate2D)endLocation
NSMutableArray*maps?=?[NSMutableArrayarray];
//蘋果地圖
NSMutableDictionary*iosMapDic?=?[NSMutableDictionarydictionary];
iosMapDic[@"title"]?=@"蘋果地圖";
[mapsaddObject:iosMapDic];
//谷歌地圖if([[UIApplicationsharedApplication]canOpenURL:[NSURLURLWithString:@"comgooglemaps://"]])?{
NSMutableDictionary*googleMapDic?=?[NSMutableDictionarydictionary];
googleMapDic[@"title"]?=@"谷歌地圖";
NSString*urlString?=?[[NSStringstringWithFormat:@"comgooglemaps://?x-source=%@&x-success=%@&saddr=&daddr=%f,%f&directionsmode=driving",@"導(dǎo)航測(cè)試",@"nav123456",endLocation.latitude,?endLocation.longitude]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
googleMapDic[@"url"]?=?urlString;
[mapsaddObject:googleMapDic];
}
returnmaps;
}
#pragma?mark?LCActionSheetDelegate
-(void)actionSheet:(LCActionSheet*)actionSheetdidClickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex?!=?-1)?{
if(buttonIndex?==0)?{
[selfnavAppleMap];
return;
}
NSDictionary*dic?=self.maps[buttonIndex];
NSString*urlString?=?dic[@"url"];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:urlString]];
}
}
//蘋果地圖
-?(void)navAppleMap
{
CLLocationCoordinate2D?gps?=?[JZLocationConverterbd09ToWgs84:self.destinationCoordinate2D];
MKMapItem*currentLoc?=?[MKMapItemmapItemForCurrentLocation];
MKMapItem*toLocation?=?[[MKMapItemalloc]initWithPlacemark:[[MKPlacemarkalloc]initWithCoordinate:gpsaddressDictionary:nil]];
NSArray*items?=?@[currentLoc,toLocation];
NSDictionary*dic?=?@{
MKLaunchOptionsDirectionsModeKey?:?MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsMapTypeKey?:?@(MKMapTypeStandard),
MKLaunchOptionsShowsTrafficKey?:?@(YES)
};
[MKMapItemopenMapsWithItems:itemslaunchOptions:dic];
}
版權(quán)聲明:本文為博主原創(chuàng)文章,未經(jīng)博主允許不得轉(zhuǎn)載呀舔。