xcode 如何避免在 iOS 9.0 中由 openURL 触发的“想要打开”对话框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32312009/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to avoid "wants to open" dialog triggered by openURL in iOS 9.0
提问by Roy K
I use openURL to open app Bfrom App A, and I get this alert dialog "App Awants to open App B", with two buttons, "Open" and "Cancel".
我使用 openURL从App A打开应用程序 B,我收到了这个警告对话框“应用程序 A想要打开应用程序 B”,有两个按钮,“打开”和“取消”。
If I press "Cancel", app Bwon't open and dialog will appear again.
如果我按“取消”,应用程序 B将不会打开并且对话框会再次出现。
If I press "Open", app Bwill open and dialog won't appear again.
如果我按“打开”,应用程序 B将打开并且对话框不会再次出现。
I would like to somehow to make it not appear to begin with. I am wondering if there is a key I should add to app A's info.plist in order to skip the dialog step when doing openURL to app B.
我想以某种方式让它看起来不像开始。我想知道是否有一个密钥我应该添加到app A的 info.plist 以便在对app B执行 openURL 时跳过对话步骤。
Any ideas?
有任何想法吗?
Update:
更新:
After checking, I could not come up with a solution for my problem. It looks like this dialog will appear regardless. I hope Apple will add the option to handle it automatically as if both apps are mine, logically, there should not be any dialog to confirm switching between them...
检查后,我无法为我的问题提出解决方案。看起来这个对话框无论如何都会出现。我希望 Apple 将添加自动处理它的选项,就好像两个应用程序都是我的一样,从逻辑上讲,不应该有任何对话框来确认它们之间的切换......
采纳答案by Roy K
After checking for hours, I could not come up with a solution for my problem. It looks like this dialog will appear regardless anything... I hope Apple will add the option to handle it in the app's info.plist as if both apps are mine, logically, there should not be any dialog to confirm switching between them...
检查了几个小时后,我无法想出解决我的问题的方法。看起来这个对话框无论如何都会出现......我希望Apple会在应用程序的info.plist中添加处理它的选项,就好像这两个应用程序都是我的一样,从逻辑上讲,不应该有任何对话框来确认它们之间的切换...... .
回答by Steve Forbes
http://www.macstories.net/linked/ios-9-bringing-changes-to-url-schemes/
http://www.macstories.net/linked/ios-9-bringing-changes-to-url-schemes/
Starting on iOS 9, apps will have to declare what URL schemes they would like to be able to check for and open in the configuration files of the app as it is submitted to Apple. This is essentially a whitelist that can only be changed or added to by submitting an update to Apple.
从 iOS 9 开始,当应用程序提交给 Apple 时,应用程序必须声明他们希望能够在应用程序的配置文件中检查和打开的 URL 方案。这本质上是一个白名单,只能通过向 Apple 提交更新来更改或添加。
openURL / canOpenURL has changed in iOS9 due to user privacy. I suggest you read http://awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes
由于用户隐私,openURL / canOpenURL 在 iOS9 中发生了变化。我建议你阅读http://awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes
The user will now see this prompt the first time you ask for permission as per other permission requests. This is an OS change and apps, including core applications such as messages now ask for permission when opening a custom URL scheme for the first time.
用户现在将在您根据其他权限请求第一次请求权限时看到此提示。这是操作系统更改和应用程序,包括核心应用程序,例如现在在首次打开自定义 URL 方案时请求许可。
You also may be able to achieve what you are trying to do using Universal Links - https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12
您也可以使用通用链接来实现您想要做的事情 - https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc /uid/TP40016308-CH12