在网上找到了下在记录下来以后方便用

在程序中调用系统自带的应用,比如我进入程序的时候,希望直接调用safar来打开一个网页,下面是一个简单的使用:

查看更多iPhone应用程序的调用和第三方应用程序的调用,可以在iPhone的URL方案查看。下面列举部分:

Apple iPhone Applications
Safari
Any URL starting with http:// which does not point to maps.google.com or www.youtube.com is sent to Safari:

NSString *stringURL = @"http://wiki.akosma.com/";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Apparently feed:// opens http://reader.mac.com in Safari.

Maps

//调用系统自带地图
    NSString *title = @"title";
    float latitude = 35.4634;
    float longitude = 9.43425;
    int zoom = 13;
    NSString *stringURL = [NSString stringWithFormat:@"http://maps.apple.com/?q=%@@%1.6f,%1.6f&z=%d", title, latitude, longitude, zoom];
    NSURL *url = [NSURL URLWithString:stringURL];
    [[UIApplication sharedApplication] openURL:url];

//调用高德地图,如果没有下载应用就调用不了
    NSString *title = @"title";
    float latitude = 35.4634;
    float longitude = 9.43425;
    int zoom = 13;
    NSString *stringURL = [NSString stringWithFormat:@"http://ditu.amap.com//maps?q=%@@%1.6f,%1.6f&z=%d", title, latitude, longitude, zoom];
    NSURL *url = [NSURL URLWithString:stringURL];
    [[UIApplication sharedApplication] openURL:url];

Phone
The phone links start with "tel:" but must not contain spaces or brackets (it can contain dashes and "+" signs, though):

NSMutableString *phone = [@"+ 12 34 567 89 01" mutableCopy];
[phone replaceOccurrencesOfString:@" "
                       withString:@""
                          options:NSLiteralSearch
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@"("
                       withString:@""
                          options:NSLiteralSearch
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@")"
                       withString:@""
                          options:NSLiteralSearch
                            range:NSMakeRange(0, [phone length])];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone]];
[[UIApplication sharedApplication] openURL:url];

SMS调用系统的短信
To open the SMS application, just use the sms: protocol in your URL:

NSString *stringURL = @"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
You can specify a phone number, but apparently not a default text for your message:

NSString *stringURL = @"sms:+12345678901";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

The same restrictions apply as for phone URLs, regarding spaces, brackets and dashes.

Mail
These URLs launch Mail and open the compose message controller:

NSString *stringURL = @"mailto:test@example.com";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
You can also provide more information, for a customized subject and body texts:

NSString *subject = @"Message subject";
NSString *body = @"Message body";
NSString *address = @"test1@akosma.com";
NSString *cc = @"test2@akosma.com";
NSString *path = [NSString stringWithFormat:@"mailto:%@?cc=%@&subject=%@&body=%@", address, cc, subject, body];
NSURL *url = [NSURL URLWithString:[path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
You might also omit some information:

NSString *subject = @"Message subject";
NSString *path = [NSString stringWithFormat:@"mailto:?subject=%@", subject];
NSURL *url = [NSURL URLWithString:[path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
For more complex body texts, you might want to use the CFURLCreateStringByAddingPercentEscapes() function, as explained above in this page.

YouTube
URLs starting with http://www.youtube.com open up the "YouTube" application automatically:

NSString *stringURL = @"http://www.youtube.com/watch?v=WZH30T99MaM";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
It also works with this URL (which normally brings the Flash video player used by YouTube):

NSString *stringURL = @"http://www.youtube.com/v/WZH30T99MaM";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

iTunes音乐

NSString *stringURL = @"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441";
    NSURL *url = [NSURL URLWithString:stringURL];
    [[UIApplication sharedApplication] openURL:url];

App Store
Very similar to the iTunes URLs:

NSString *stringURL = @"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=294409923&mt=8";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

iBooks
(source: http://akos.ma/aqdr)

NSString *stringURL = @"itms-books:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

NSString *stringURL = @"itms-bookss:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Third Party Applications
Most URL schemes in this list come from App Lookup.

####################################

AirSharing一款可以把iPhone变成一个网络驱动器,使得文件能够在手机与你的电脑之间进行无线来回传送,同时可以让你在自己的手机上打开浏览多种类型的文件。
Launch the application:

NSString *stringURL = @"airsharing://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Alocola 金山词霸
Launch the application:

NSString *stringURL = @"alocola://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Appigo Notebook
Launch the application:

NSString *stringURL = @"appigonotebook://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Appigo Todo
Launch the application:

NSString *stringURL = @"appigotodo://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Create a new task:

NSString *template = @"appigotodo://com.example.xyzapp/import?name=%@&note=%@&due-date=%@&priority=%@&repeat=%@";
NSString *name = @"Buy%20some%20milk";
NSString *note = @"Stop%20on%20the%20way%20home%20from%20work.";
NSString *dueDate = @"2009-07-16";
NSString *priority = @"1";
NSString *repeat = @"101";
NSString *stringURL = [NSString stringWithFormat:template, name, note, dueDate, priority, repeat];
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

Duo
Launch the application and pre-populate the update field with your desired Tweet/Facebook update. Optional: Provide Duo with the custom URL and return path to your app to provide the user with a button to return to your app.

NSString *appID = @"Your Apps Name";
NSString *updateInfo = @"The Tweet/Status Update";
NSString *returnScheme = @"Your Apps Return URL Scheme";
NSString *returnPath = @"Your/Apps/Return/Path";
NSString *baseURL = @"duoxx://updateFaceTwit?";
 NSString *encodedUpdateInfo = [updateInfo stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString *urlString = [NSString stringWithFormat:@"%@BLappID=%@;BLupdateInfo=%@;BLreturnScheme=%@;BLreturnPath=%@",
         baseURL, appID, encodedUpdateInfo, returnScheme, returnPath];

NSURL *url = [NSURL URLWithString:urlString];
[[UIApplication sharedApplication] openURL:url];

The Cartographer
Launch app and add a placemark at given coordinate:

NSString *title = @"Placemark title (optional)";
NSString *summary = @"Placemark description (optional)";
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(123.0, 12.0);

title = [(id)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)title, NULL, (CFStringRef)@";/?:@&=+$,", kCFStringEncodingUTF8) autorelease];
summary = [(id)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)summary, NULL, (CFStringRef)@";/?:@&=+$,", kCFStringEncodingUTF8) autorelease];

NSString *cartographerURL = [NSString stringWithFormat:@"cartographer://placemark?coordinate=%lf,%lf&title=%@&summary=%@",
         coordinate.latitude, coordinate.longitude, title, summary];

NSURL *url = [NSURL URLWithString:cartographerURL];
[[UIApplication sharedApplication] openURL:url];

Launch app and load either a KML source or a Google My Map:

NSString *sourceURL = @"http://....";
// e.g. http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=208320711678395936256.00046bbcfdcd1f3ebf64b&z=5

// Optional:
MKCoordinateRegion region = ...;
sourceURL = [sourceURL stringByAppendingFormat:@"&ll=%lf,%lf&spn=%lf,%lf",
               region.center.latitude, region.center.longitude, region.span.latitudeDelta, region.span.longitudeDelta];

NSURL *url = [NSURL URLWithString:[sourceURL stringByReplacingOccurrencesOfString:@"http://" withString:@"cartographer://"]];
[[UIApplication sharedApplication] openURL:url];

ChatCo

NSString *stringURL = @"irc://irc.example.domain/roomName";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
NSString *stringURL = @"irc://irc.example.domain/Nickname@roomName";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
NSString *stringURL = @"irc://irc.example.domain/Nickname!Realname@roomName";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

转载于:https://www.cnblogs.com/linxiu-0925/p/5433970.html

iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话,iTunes,iBooks )...相关推荐

  1. Android调用系统打电话和发短信功能

    一.打电话 1.添加打电话的权限在manifast文件中. <uses-permission Android:name="android.permission.CALL_PHONE&q ...

  2. iOS 应用中调用系统写邮件

    在使用MFMailComposeViewController 之前需要引入messageui 如: @import MessageUI; 具体实现 MFMailComposeViewControlle ...

  3. [转]mpvue中的小程序调用系统自带查看图片的功能

    mpvue中的小程序调用系统自带查看图片的功能 这里举个栗子: <template><div class="keting"><div class=&q ...

  4. 安卓手机如何打开php文件夹,Android_Android中调用系统的文件浏览器及自制简单的文件浏览器,调用系统自带的文件浏览器- phpStudy...

    Android中调用系统的文件浏览器及自制简单的文件浏览器 调用系统自带的文件浏览器这很简单: /** 调用文件选择软件来选择文件 **/ private void showFileChooser() ...

  5. android安装自动打开网页,Android调用系统自带浏览器打开网页的实现方法

    Android调用系统自带浏览器打开网页的实现方法 在Android中可以调用自带的浏览器,或者指定一个浏览器来打开一个链接.只需要传入一个uri,可以是链接地址. 启动android默认浏览器 在A ...

  6. ShareIntentUtil【调用系统自带的分享的工具类】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 根据参考资料的文章,整理了调用系统自带分享的工具类(实现了适配7.0FileProvider的功能),需要搭配<Android ...

  7. C#在winform中调用系统控制台输出

    SeayXu 原文C#在winform中调用系统控制台输出 在Winform程序中有时候调试会通过Console.Write()方式输出一些信息,这些信息是在Visual Studio的输出窗口显示. ...

  8. Android中调用系统已安装的播放器来播放网络流媒体视频

    2019独角兽企业重金招聘Python工程师标准>>> 实现思路比较简单几行代码就可以搞定,在界面放一个Button或者带有播放图标的imageview,点击事件中调用本地播放器来播 ...

  9. 本地方法(JNI)——从java 程序中调用C函数

    [0]README 1) 本文部分文字描述 转自 core java volume 2 , 旨在理解 本地方法--从java 程序中调用C函数 的基础知识 : 2) for source code, ...

最新文章

  1. 【POJ1509】Glass Beads 【后缀自动机】
  2. linux time 统计命令执行的时间
  3. 网上收集下boost::asio发送与传输相关的几个函数,老是忘记
  4. SiamMask:视频跟踪最高精度 (中科院王强大神作品)
  5. VTK:网格之ElevationFilter
  6. 字典序最小是什么意思_《拓扑序简介》第十六讲
  7. 【LeetCode】拓扑排序
  8. visio交叉线去掉交叉点弯曲方法
  9. idea中怎么新建vue项目_项目中使用vue-awesome-swiper
  10. [ 总结 ] 删除通过find查找到的文件
  11. python 阿里云短信接口_python 之阿里云短信服务接入流程短信接口
  12. python 内存文件_python基础知识-7-内存、深浅、文件操作
  13. 云计算在互联网发展史中的坐标
  14. VS2010编译的程序在XP上无运行库执行,以及ADO在XP上报80004003的错误处理
  15. rhel6 PXE网络装机和Kickstart无人值守安
  16. 主DNS、辅助DNS、缓存DNS和基于CDN的利用DNS服务器实现负载均衡
  17. 深入理解JVM的对象创建过程
  18. python 仪表盘实现_使用python绘制一个仪表盘显示
  19. 自学Java篇之JFrame创建《石头迷阵小游戏》
  20. SQLserver中建立外键时显示引用了无效的表

热门文章

  1. 移动WEB开发五、响应式布局
  2. Siebel界面的搭建
  3. 2021-2028年按技术(2D、3D、面部分析)、应用程序(访问控制、安全和监控)、最终使用、地区和细分预测分列的面部识别市场规模、份额和趋势分析报告
  4. java mail 抄送多用户,JavaMail 发送邮件,收件人为多人,抄送多人。其中包含收件人邮箱错误时的处理...
  5. Windows 10下载安装Java
  6. 输入一元二次方程的三个系数求方程的根(考虑不存在)
  7. 美国计算机科学就业率,美国计算机就业率最高的30所大学
  8. 苹果CMS10灰色高端电影网站模板源码可对接公众号
  9. >>技术应用:用于 REST API 开发和测试的 10 大工具
  10. 图解CISCO 3550忘记密码解决方法