How to use url scheme for application not installed in device

元气小坏坏 提交于 2019-12-04 02:30:03

问题


I have an application in store, which allow to display a list of items in a first view, details of an item in the second view.

I use the url schemes to access to the details of an item from an external source (Facebook for exemple)

My question: if the application was not installed in the device, is there any way that allow to download the application and open it at the right item (using url scheme)

Thank in advance


回答1:


For iOS>9

if ([[UIApplication sharedApplication] openURL:SchemaURL] == false)
{
   [[UIApplication sharedApplication] openURL:iTunesAppURL];
}



回答2:


What you're describing is called Deferred Deep Linking (Deep Linking refers to using a link to open your app directly to a specific piece of content, and Deferred means that it works even if the app isn't installed first).

Unfortunately there's no native way to accomplish this on either iOS or Android. URL schemes don't work, because they always fail with an error if the app isn't installed. Apple's newer Universal Links in iOS 9+ get closer in that they at least don't trigger an error if the app isn't installed, but you'd still have to handle redirecting the user from your website to the App Store. You can't pass context through to the app after install with Universal Links, so you wouldn't be able to send the user to the correct item, and they actually aren't supported in a lot of places.

To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do. A free service like Branch.io (full disclosure: they're so awesome I work with them) or Firebase Dynamic Links can handle all of this for you.




回答3:


First Query that URLScheme and know about the status of the application whether it is installed or not. If it is not installed give him/her a popup to install that application from app store. You can navigate user to app store link when clicks OK from alert.



来源:https://stackoverflow.com/questions/41329733/how-to-use-url-scheme-for-application-not-installed-in-device

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