openURL的使用方法
openURL的使用方法
openURL的使用方法:
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
其中系统的appString有:
- Map http://maps.google.com/maps?q=Shanghai
- Email mailto://myname@google.com
- Tel tel://10086
- Msg sms://10086
Map http://maps.google.com/maps?q=Shanghai
Email mailto://myname@google.com
Tel tel://10086
Msg sms://10086
除此之外,还可以自己定义URL,方法如下:
- 打开info.plist,添加一项URL types
- 展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme
- 展开URL Scheme,将Item1的内容修改为myapp
- 其他程序可通过myapp://访问此自定义URL
打 开info.plist,添加一项URL types 展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme 展开URL Scheme,将Item1的内容修改为myapp 其他程序可通过myapp://访问此自定义URL
参考资料:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo}
http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html
openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是Iphone开发中我经常需要用到的一段代码,它仅仅只有一行而已。
- - (IBAction)openMaps {
- //打开地图
- NSString *addressText = @"beijing";//@"1 Infinite Loop, Cupertino, CA 95014";
- addressText = [addressText stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
- NSString *urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
- NSLog(@"urlText =============== %@", urlText);
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
- }
- (IBAction)openMaps {
//打开地图
NSString *addressText = @"beijing";
//@"1 Infinite Loop, Cupertino, CA 95014";
addressText = [addressText stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString *urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
NSLog(@"urlText =============== %@", urlText);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}
- - (IBAction)openEmail {
- //打开mail
- // Fire off an email to apple support
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];
- }
- (IBAction)openEmail {
//打开mail // Fire off an email to apple support
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];
}
- - (IBAction)openPhone {
- //拨打电话
- // Call Google 411
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];
- }
- (IBAction)openPhone {
//拨打电话
// Call Google 411
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];
}
- - (IBAction)openSms {
- //打开短信
- // Text to Google SMS
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];
- }
- (IBAction)openSms {
//打开短信
// Text to Google SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];
}
- -(IBAction)openBrowser {
- //打开浏览器
- // Lanuch any iPhone developers fav site
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]];
- }
-(IBAction)openBrowser {
//打开浏览器
// Lanuch any iPhone developers fav site
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]];
}
openURL的使用方法的更多相关文章
- openURL的使用方法:
openURL的使用方法: view plaincopy toclipboardprint? [[UIApplication sharedApplication] openURL:[NS ...
- iOS9 application:application openURL: sourceApplication: annotation: 方法不执行
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url NS_DEPRECATED_IOS(2_0, 9 ...
- (转)openURL的使用方法
view plaincopy to clipboardprint? [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ap ...
- app跳转openURL,兼容方法
- (void)openScheme:(NSString *)scheme { UIApplication *application = [UIApplication sharedApplicat ...
- Unity iOS打开AppStore评星页面,浅谈Application.OpenURL()方法。
http://fairwoodgame.com/blog/?p=38 Unity iOS打开AppStore评星页面,浅谈Application.OpenURL()方法. Posted in Uni ...
- (译)openURL 在 iOS10中已弃用
翻译自:openURL Deprecated in iOS10 译者:Haley_Wong 苹果在iOS 2 推出了 openURL:方法 作为一种打开外部链接的方式.而与之相关的方法 canOpen ...
- OpenURL的一些用法
openURL的使用方法: view plaincopy to clipboardprint? [[UIApplication sharedApplication] openURL:[NSURL UR ...
- easyUI 如何不跳转页面,只是加载替换center部分内容
以前做的一个故障报修系统,前端框架使用easyUI框架,layout布局,center使用datagrid .点击左边树形菜单时时页面跳转,想要知道如何点击菜单时不进行页面跳转,而是只对center模 ...
- iOS开发200个tips总结(一)
tip 1 : 给UIImage添加毛玻璃效果 func blurImage(value:NSNumber) -> UIImage { let context = CIContext(opti ...
随机推荐
- android和struts2实现android文件上传
1.开发准备如下2个工具类 package org.lxh.util; import java.io.BufferedReader; import java.io.InputStreamReader; ...
- hadoop-2.0.0-mr1-cdh4.2.0源码编译总结
准备编译hadoop-2.0.0-mr1-cdh4.2.0的同学们要谨慎了.首先看一下这篇文章: Hadoop作业提交多种方案 http://www.blogjava.net/dragonHadoop ...
- [LeetCode#261] Graph Valid Tree
Problem: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair o ...
- dedecms网站如何做在线订单功能
做网站的时候经常会遇到做在线订单的这个功能,而且这个功能会在企业网站的建设中经常的遇到,今天51模板集就拿物流网的在线订单功能做一个详细的介绍. 第一步:自定义表单 打开后台:核心-->自定义表 ...
- Hibernate(十一)多对多双向关联映射
上次我们在中Hibernate从入门到精通(十)多对多单向关联映射讲解了一下多对多单向关联映射,这次我 们讲解一下七种映射中的最后一种多对多双向关联映射. 多对多双向关联映射 按照我们之前的惯例,先看 ...
- Import larger wordpress xml file
The maximum size is controlled by two PHP settings: upload_max_filesize, and post_max_size. These ar ...
- Sicily1020-大数求余算法及优化
Github最终优化代码: https://github.com/laiy/Datastructure-Algorithm/blob/master/sicily/1020.c 题目如下: 1020. ...
- 【转】SVN linux命令及 windows相关操作(二)
转自这里:http://www.uml.org.cn/pzgl/200904246.asp 1 安装及下载client 端 2 什么是SVN(Subversion)? 3 为甚么要用SVN? 4 怎么 ...
- codeforces 421d bug in code
题目链接:http://codeforces.com/problemset/problem/421/D 题目大意:每个人说出自己认为的背锅的两个人,最后大BOSS找两个人来背锅,要求至少符合p个人的想 ...
- 一个Hibernate小程序
基本步骤 在前一篇博文Hibernate环境搭建中为大家详细的介绍如何搭建一个学习新类库的学习环境.今天,为大家带来一个Hibernate小例子,让大家能够快速上手. 步骤如下: 1.配置hibern ...