iOS 10自定义URL方案不再起作用 [英] iOS 10 Custom URL Scheme no longer working

查看:58
本文介绍了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方案不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆