How iOS handle URL scheme duplication?

房东的猫 提交于 2019-12-04 19:29:40

问题


If 2 other app register same url scheme, how iOS handle this?


回答1:


It will present an UIActionSheet view allowing the user to choose which app to launch (good example are apps that handle .doc files). That's where the icon you specify is used - on the action sheet buttons when it's shown to the user




回答2:


The iOS Documentation reads:

Note: If more than one third-party app registers to handle the same URL scheme, there is currently no process for determining which app will be given that scheme.

The OSs behaviour is undefined if there are two apps registered for an URL scheme, therefore you should try to define a handler that is specific for your app to avoid this situation (e.g. awesomeMapsApp:// instead of maps://).




回答3:


Actually it can be really problematic. For example, til' March 2016, an app called Grabb handles PayPal schemes so that if your app tries to open PayPal (with all the security nonce etc. within the call) it launches Grabb instead, and you can do nothing about it. Even with the openURL alertView added in iOS 9, it can still be a big security issue.




回答4:


Here is what I have tested:

iOS 5: the first installed app will be chosen. If you delete first installed app, then the others will not launch unless you install again.

iOS 6: the lastest installed app will be chosen. If you delete the lastest installed app, then the previous installed app will be chosen.



来源:https://stackoverflow.com/questions/5103260/how-ios-handle-url-scheme-duplication