IOS进程间通信
来源:互联网 发布:php可以写后端吗 编辑:程序博客网 时间:2024/04/24 03:13
首先我们需要两个app。第一个app在touchbegan方法中加入下面代码:
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { NSString *path = @"123://saywhat"; [[UIApplication sharedApplication]openURL:[NSURL URLWithString:path] options:@{} completionHandler:^(BOOL success) { if(success){ NSLog(@"成功"); }else{ NSLog(@"失败"); } }];
说明下path中的 123是另一个app指定的名字 //后面的为任意内容 是你想传到另一个app的参数。
下面看另一个app 如果设置 告诉这个app自己的名字 需要配置info.plist 如下图:
在123中接收传递的参数
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{ NSString *info = url.description; UILabel *l = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 300, 100)]; l.text = info; l.backgroundColor = [UIColor yellowColor]; [self.window.rootViewController.view addSubview:l]; return YES; }
跳转以后传递结果如下:
阅读全文
0 0
- IOS进程间通信
- IOS进程间通信
- 进程间通信 (OSX/iOS)
- 进程间通信 (OSX/iOS)
- 进程间通信 (OSX/iOS)
- 进程间通信 (OSX/iOS)
- ios 应用进程间通信
- 进程间通信 (OSX/iOS)
- iOS内IPC-------------进程间通信
- iOS-进程间通信-URL Schema
- iOS进程间通信之CFMessagePort
- iOS进程间通信之CFMessagePort
- iOS--CFMessagePort实现进程间通信
- iOS进程通信
- ios进程间通信问题之一--进程间通信 (OSX/iOS)
- 进程&进程间通信
- IOS-62-实现进程间、线程间通信的方式
- iOS内IPC(进程间通信)方法小结
- 在运行时请求权限 android
- 机器学习实战-支持向量机
- Unity Transform
- for...in...循环搭配对象解构赋值的易错点
- Android7.0中文文档(API)--- BaseExpandableListAdapter
- IOS进程间通信
- Swift3之细致理解Optional(可选类型)
- 解决android studio3.0 preview一直卡在Gradle:Resolve dependencies':classpath'的问题
- DDoS攻击与CC攻击的区别
- web网页 页面布局的几种方式
- Json的简单介绍
- Nodejs学习(二)http服务程序
- jquery设置点击标签,标签滚动到页面顶部
- 科三 二十里铺(带视频)