iOS应用之间调用
2015-12-14 16:39
399 查看
//
// iOS应用之间调用.h
// IOS笔记
1。判断系统里是否安装了某个app。比如新浪微博应用注册了URL scheme为@"weibo",我们可以通过
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weibo://"]]来判断系统里是否发装了新浪微博。
2。从一个应用里启动另一个应用。可以通过接口
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"weibo://"]]来启动微博。
参数要根据微博里规定的方式传递,一般就像http的get方式传参一样。
当然启动以后,自己的应用就会退到后台,想要再切回来,就要在自己的应用里也注册URL scheme。做为回调参数传给微博app。
NSURL *url = [NSURL URLWithString:@"http://QZone.qq.com"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"message" message:[NSString stringWithFormat:@"%@",url] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
}
// iOS应用之间调用.h
// IOS笔记
1。判断系统里是否安装了某个app。比如新浪微博应用注册了URL scheme为@"weibo",我们可以通过
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weibo://"]]来判断系统里是否发装了新浪微博。
2。从一个应用里启动另一个应用。可以通过接口
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"weibo://"]]来启动微博。
参数要根据微博里规定的方式传递,一般就像http的get方式传参一样。
当然启动以后,自己的应用就会退到后台,想要再切回来,就要在自己的应用里也注册URL scheme。做为回调参数传给微博app。
NSURL *url = [NSURL URLWithString:@"http://QZone.qq.com"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"message" message:[NSString stringWithFormat:@"%@",url] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
}
相关文章推荐
- iOS_带下划线的Label
- iOS9适配中的各种问题
- ios Core Data
- IOS 蓝牙4.0(BLE 协议) 初窥
- 源码推荐(12.14):iOS mansory纯代码自动计算cell高度,手势密码解锁
- ios bundle
- iOS内存管理下
- IOS开发项目图标问题
- IOS开发NSString与int和float的相互转换以及字符串拼接
- (iOS消息推送原理) 详情
- iOS开发中的证书问题
- IOS 实现 AAC格式 录音 录音后自动播放
- js判断ios/Android,页面跳至对应页面
- KVC和KVO
- JS判断客户端是否是iOS或者Android
- IOS--- NavigationBar标题按钮
- IOS 基础框架名称
- iOS开发之Core Data数据存储
- iOS 硬件授权检测:定位服务、通讯录、日历、提醒事 项、照片、蓝牙共享、麦克风、相机等
- iOS键盘隐藏