iOS 10 新特性之openURL
来源:互联网 发布:dota2 a卡优化 编辑:程序博客网 时间:2024/05/22 16:54
一、iOS之前一直使用openURL,来打开设置页面、其他APP应用。
- (BOOL)openURL:(NSURL*)url NS_DEPRECATED_IOS(2_0, 10_0, "Please use openURL:options:completionHandler: instead") NS_EXTENSION_UNAVAILABLE_IOS("");
现如今API改为了一下:
// Options are specified in the section below for openURL options. An empty options dictionary will result in the same// behavior as the older openURL call, aside from the fact that this is asynchronous and calls the completion handler rather// than returning a result.// The completion handler is called on the main queue.- (void)openURL:(NSURL*)url options:(NSDictionary<NSString *, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("");
- 传和不传,结果都是一样的;
- block是在主线程的。
用法:[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) { //TODO }];
1.2 统对于option的定义
// Option for openURL:options:CompletionHandler: only open URL if it is a valid universal link with an application configured to open it// If there is no application configured, or the user disabled using it to open the link, completion handler called with NOUIKIT_EXTERN NSString *const UIApplicationOpenURLOptionUniversalLinksOnly NS_AVAILABLE_IOS(10_0);
1.参数是用来校验url和applicationConfigure是否配置正确,是否可用。如果不满足则返回NO;
用法:
[[UIApplication sharedApplication] openURL:url options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@YES} completionHandler:^(BOOL success) { //TODO }];
0 0
- iOS 10 新特性之openURL
- [iOS]IOS10 新openURL的特性
- iOS 10 新特性
- iOS 10 新特性
- iOS 10 新特性
- iOS 10 新特性
- openURL 不能使用iOS 10
- iOS 10 SDK 新特性
- openURL ios
- iOS:openURL
- iOS 之UIApplication的OpenURL简介
- iOS 7 新特性之ViewController切换
- iOS新特性之转场动画
- iOS 8新特性之扩展(Extension)
- iOS ios8新特性之扩展
- iOS ios8新特性之扩展详解
- iOS ios8新特性之扩展
- iOS 8新特性之扩展
- pycharm快捷键
- 支付宝开发表设计 适用于 所有支付业务
- listview和imageview实现条目单选效果
- ubuntu下如何安装android studio
- Path Sum I II III
- iOS 10 新特性之openURL
- Kotlin(二)-->基础语法
- Ubuntu下使用SSH和FileZilla远程登陆
- 华为,计算给定时间的下一秒,java
- 队列写杨辉三角(拿两个队列写的。。。。
- MySql5.7.14存储表情字符报错Incorrect string value
- oracle创建与使用视图
- Java Web 学习路线
- EditText的问题