Is there an alternative to (the deprecated) canOpenURL in iOS 9?

你离开我真会死。 提交于 2019-12-21 17:13:10

问题


I am using apple's canOpenURL: and openURL: methods to detect & open other application. But as these methods are deprecated in iOS9, They returns NO.

Is there any alternate to manage this?

Thanks


回答1:


You need to provide "whitelist" to your plist

<key>LSApplicationQueriesSchemes</key>
<array>
 <string>urlscheme</string>
 <string>urlscheme2</string>
 <string>urlscheme3</string>
 <string>urlscheme4</string>
</array> 

See for more details

iOS 9 has made a small change to the handling of URL scheme.

More details




回答2:


Here you can find some information.

as the article said:

Up until iOS 9, apps have been able to call these methods on any arbitrary URLs. 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. It appears that certain common URLs handled by system apps, like “http”, “https”, do not need to be explicitly whitelisted.

In short: Apple wants to prevent apps from being able to scan a user's device and know which apps are installed

So to answer to your question: actually there is no solution, because apple want exactly to prevent this kind of behaviour




回答3:


In some contexts, if you need to open arbitrary deeplinks, the Universal App Links can be a solution: you point to the website of the app (which needs to implement this behaviour) and iOS 9 will automatically deeplink to the adhoc app.



来源:https://stackoverflow.com/questions/31470784/is-there-an-alternative-to-the-deprecated-canopenurl-in-ios-9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!