app之间的跳转,查看URL的端口号,主机信息
2016-04-05 16:27
471 查看
//查看Url的状态
- (void)aboutUrl{
* AppTwo表示要跳转到的APP的URL Schemas
* 需要在AppTwo的APP的info--->URLTypes下面配置URL Schemas为AppTwo,不能有下划线
* "://"是固定写法,URL才回被认可
* 后面的str是要传给下一个app的参数
//跳转到对应App
//AppTwo://表示目的应用程序的url
//123这是给下个应用传递参数
NSString *toPath = [NSString stringWithFormat:@"AppTwo://%@",@"123"];
NSURL *toUrl = [NSURL URLWithString:toPaht];
//打开程序
//openURL表示启动别的应用程序
[[UIApplication sharedApplication]openURL:toUrl];
NSURL *url = [NSURL URLWithString:toPath];
[[UIApplication sharedApplication] openURL:url];
//协议
NSLog(@"scheme:%@", [url scheme]);
//url的一部分
NSLog(@"relativeString:%@", [url relativeString]);
//完整的url字符串(绝对路径)
NSLog(@"absoluteString:%@", [url absoluteString]);
//主机
NSLog(@"host:%@", [url host]);
//端口
NSLog(@"port:%@", [url port]);
//路径search
NSLog(@"path:%@", [url path]);
//search
NSLog(@"pathComponents:%@", [url pathComponents]);
//参数id
NSLog(@"query:%@", [url query]);
}
- (void)aboutUrl{
* AppTwo表示要跳转到的APP的URL Schemas
* 需要在AppTwo的APP的info--->URLTypes下面配置URL Schemas为AppTwo,不能有下划线
* "://"是固定写法,URL才回被认可
* 后面的str是要传给下一个app的参数
//跳转到对应App
//AppTwo://表示目的应用程序的url
//123这是给下个应用传递参数
NSString *toPath = [NSString stringWithFormat:@"AppTwo://%@",@"123"];
NSURL *toUrl = [NSURL URLWithString:toPaht];
//打开程序
//openURL表示启动别的应用程序
[[UIApplication sharedApplication]openURL:toUrl];
NSURL *url = [NSURL URLWithString:toPath];
[[UIApplication sharedApplication] openURL:url];
//协议
NSLog(@"scheme:%@", [url scheme]);
//url的一部分
NSLog(@"relativeString:%@", [url relativeString]);
//完整的url字符串(绝对路径)
NSLog(@"absoluteString:%@", [url absoluteString]);
//主机
NSLog(@"host:%@", [url host]);
//端口
NSLog(@"port:%@", [url port]);
//路径search
NSLog(@"path:%@", [url path]);
//search
NSLog(@"pathComponents:%@", [url pathComponents]);
//参数id
NSLog(@"query:%@", [url query]);
}
相关文章推荐
- Android Studio 1.3.0 以上gradle proxy代理设置异常
- [安卓开发笔记二]android Studio通过jni调用C++代码
- 【iOS】获取App的常用文件路径
- iOS各大名人的博客
- Android之AsyncTask学习
- Android学习系列(1)--为App签名(为apk签名)
- cocos2d android分析之-libcocos2dlua.so库
- iOS 更新约束
- I.MX6 Android iperf3 porting failed
- 【Android 基础】Animation 动画介绍和实现
- 29.Android展示PDF文件
- 关于fragment切换失效问题
- Appscan---会话标识未更新
- 谈谈iOS 的加密技术
- android shape的使用
- java中的Object...是什么意思详解。
- Android ListView相关技术
- 模仿美团点评的Android应用中价格和购买栏悬浮固定的效果
- android加载html乱码解决办法
- Android Market 链接的生成与分享