iOS 10自定义URL方案不再起作用

编程入门 行业动态 更新时间:2024-10-09 23:16:47
本文介绍了iOS 10自定义URL方案不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个设置了自定义URL方案的应用程序,并将该URL添加到了Info.plist中的LSApplicationQueriesSchemes数组中.

I have an app with a custom URL scheme set up, and I added the URL to the LSApplicationQueriesSchemes array in the Info.plist.

如果我直接在设备或模拟器上进入Safari并点击myapp://,则该应用将打开.但是,我有一个带有servlet的外部托管网站,该servlet调用response.redirect("myapp://"),并且在调用此方法时,该应用程序无法打开.

If I go straight into Safari on the device or simulator and hit myapp:// then the app will open up. However, I have an externally hosted website with a servlet that calls response.redirect("myapp://") and when this is called, the app does not open.

该servlet重定向在iOS 9及以下版本中有效.iOS 10中发生了什么变化,因此该调用不再起作用?

The servlet redirect works in iOS 9 and below. What changed in iOS 10 so that this call no longer works?

奇怪的是,如果我手动在设备上的Safari中输入URL,它就可以正常工作.但是在设备上的Safari中访问我的网站并单击调用response.redirect的按钮不起作用.我对此完全感到困惑.

It's odd that if I type in the URL by hand into Safari on the device, it works fine. But going to my website in Safari on the device and clicking the button which calls the response.redirect does not work. I am completely flummoxed by this.

推荐答案

我实际上必须通过更改发送重定向的servlet的工作方式来解决此问题.仅当您单击链接并立即从html页面重定向时,此方法才有效.在iOS 10之前,我可以使用它,以便您单击提交表单的按钮,然后从servlet进行重定向.更改该servlet的逻辑和结构后,我现在有了一个直接的href链接,该链接调用了回调URL,并且可以正常工作.因此,iOS中没有修复的问题-我仍然不确定是什么改变了(大概是在Safari中)以打破这一点,但是您就可以了.

I actually had to solve this by changing the way the servlet that sent the redirect worked. It only works if you click a link and are redirected from the html page now. Before iOS 10, I had it working so that you clicked a button which submitted a form and the redirect occurred from the servlet. Changing the logic and structure of that servlet, I now have a straight href link which invokes the callback URL, and that works. So nothing fixed in iOS - I'm still not sure what changed, presumably in Safari, to break this, but there you go.

更多推荐

iOS 10自定义URL方案不再起作用

本文发布于:2023-11-23 01:03:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619545.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   方案   iOS   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!