当前位置: 首页 > news >正文

IOS 18下openURL 失效问题

突然有一天有玩家反馈说应用打开外部连接打不开了,于是查了一下,报错:

BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(_:) needs to migrate to the non-deprecated UIApplication.open(_:options:completionHandler:). Force returning false (NO).

由于ios18废弃了旧的openURL接口,我们需要修改CCApplication-ios.mm文件的Application::openURL方法:

原先方法:

void Application::openURL(const std::string &url)
{NSString* msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];NSURL* nsUrl = [NSURL URLWithString:msg];[[UIApplication sharedApplication] openURL:nsUrl];}

改后方法:

void Application::openURL(const std::string &url)
{if (@available(iOS 10.0, *)) {[[UIApplication sharedApplication] openURL:nsUrl options:@{} completionHandler:nil];} else {[[UIApplication sharedApplication] openURL:nsUrl];}
}

这里ios 18 将打开链接的方法里面添加了回调方法,我们没有用的话可以填空,这样ios18的设备也能打开外链了。


文章转载自:
http://appologize.sxnf.com.cn
http://anvers.sxnf.com.cn
http://attitude.sxnf.com.cn
http://beadledom.sxnf.com.cn
http://astrological.sxnf.com.cn
http://anhydrous.sxnf.com.cn
http://affectingly.sxnf.com.cn
http://besprinkle.sxnf.com.cn
http://blackland.sxnf.com.cn
http://cholecyst.sxnf.com.cn
http://arfvedsonite.sxnf.com.cn
http://amphotericin.sxnf.com.cn
http://begot.sxnf.com.cn
http://anthozoa.sxnf.com.cn
http://bokhara.sxnf.com.cn
http://anuretic.sxnf.com.cn
http://accumulate.sxnf.com.cn
http://armenia.sxnf.com.cn
http://budapest.sxnf.com.cn
http://adipocere.sxnf.com.cn
http://boanerges.sxnf.com.cn
http://acclivitous.sxnf.com.cn
http://brindle.sxnf.com.cn
http://believer.sxnf.com.cn
http://capsize.sxnf.com.cn
http://chronosphere.sxnf.com.cn
http://baffling.sxnf.com.cn
http://aurochs.sxnf.com.cn
http://asbestine.sxnf.com.cn
http://castoreum.sxnf.com.cn
http://www.dtcms.com/a/280042.html

相关文章:

  • Flutter瀑布流布局深度实践:打造高性能动态图片墙
  • LVS(Linux Virtual Server)详细笔记(理论篇)
  • JavaScript进阶篇——第三章 箭头函数核心
  • 【问题排查流程总结】tmd2635模块开发中断异常,排查心得
  • python技巧:使用pyvisa控制仪器;安装NI-VISA等visa库;导入pyvisa并创建资源管理器;打开和使用仪器
  • 【 Cache 写策略学习笔记】
  • 编程项目选择思考点以及项目包装的关键点
  • linux系统------LVS+KeepAlived+Nginx高可用方案
  • 优雅的Java:01.数据更新如何更优雅
  • Rocky Linux 9 源码包安装php8
  • 基于按键开源MultiButton框架深入理解代码框架(一)(指针的深入理解与应用)
  • 开源AI Agent开发平台Dify源码剖析系列(二)
  • HTTP 协议
  • 微信小程序进度条cavans
  • 【电脑】显卡(GPU)的基础知识
  • Golang Channel与协程的完美配合指南
  • CAU数据挖掘 第五章 聚类问题
  • vscode里面怎么配置ssh步骤
  • Python+Selenium自动化爬取携程动态加载游记
  • python实现自动化sql布尔盲注(二分查找)
  • js最简单的解密分析
  • 分支战略论:Git版本森林中的生存法则
  • document.documentElement详解
  • Webshell连接工具原理
  • 渗透笔记1-4
  • html js express 连接数据库mysql
  • 【算法训练营Day12】二叉树part2
  • 进程---基础知识+命令+函数(fork+getpid+exit+wait+exec)
  • 100道K8S面试题
  • LVS初步学习