3

I've integrated custom url calls to link to specific pages on my app with the url scheme definitions like so:

myapp://?id=123

the problem is that I am not sure how to cause the iOS to go to the App Store if my app is not installed on the specific device, like Pinterest app deep links do.

pkamb
  • 33,281
  • 23
  • 160
  • 191
Or Ron
  • 2,313
  • 20
  • 34
  • From where? You're communicating between 2 apps, or 3rd party apps can trigger your app? – Wain Jul 14 '14 at 09:20
  • You can't, iOS doesn't know you apps URL until it is installed. Pinterets and Facebook redirect there normal URL to the app. – rckoenes Jul 14 '14 at 09:20
  • @rckoenes not sure what do you mean, Pinterest api will open Pinterest if Pinterest installed OR will open the app store. This is the exact behavior I want to implement but I'm not sure how – Or Ron Jul 14 '14 at 09:36
  • 2
    For example your apps URL scheme is `myapp:` then iOS will only recognize this URL id you app is installed. It will not check the app store for app that have an URL scheme `myapp:` like Android does. What Pinterest have done, It think, is redirect from there site to the app. Thus they can control the behavior, if the URL scheme is no supported they redirect to the appstore else they redirect to their app. – rckoenes Jul 14 '14 at 09:47
  • canOpenUrl method will provide you the false result and on the basis on that you can perform your own action. – Alok Jul 19 '17 at 12:07

1 Answers1

3

UIApplication has a canOpenURL: method that you can use to query the system to check if it can handle a URL with your custom scheme. If it can then you can open the URL and know your app is installed. If it can't then your app isn't installed and you need to push to the store instead.

This obviously needs to be added to an app, whether that be another one of your apps or a 3rd party app that you offer integration with.

If you mean from a web page then see this answer.

Community
  • 1
  • 1
Wain
  • 118,658
  • 15
  • 128
  • 151
  • 1
    The question was how to open the app store from a custom App Scheme if the app is not installed. – rckoenes Jul 14 '14 at 09:48
  • 1
    Good follow up, I linked to another answer that covers that at the bottom of mine as it wasn't clear in the question. – Wain Jul 14 '14 at 10:14