19

Device : iPhone 5 / iOS 9.3

I have an iOS app which I need to launch from a website. I was able to do it via custom URL scheme.

When I click the "Open App" button in the website, an alert dialog appears that says "Safari wants to open MyApp" with OK & Cancel buttons.

Clicking OK : everything is just fine. The app gets launched from the website perfectly.

Clicking Cancel : First time, it just dismisses preventing the app being launched, which is correct.

When I click on the "Open App" button once again from the website, I expect the same "Safari wants to launch MyApp" alert dialog to appear once again, which is not happening.

Instead, it shows a dialog that says "Cannot Open Page - Safari cannot open the page because the address is invalid" with an OK button.

My assumption was, every time when you click on that link in the website (that can launch the app via custom url scheme), I should be prompted with "safari wants to open MyApp" alert dialog all the time.

What am I missing here ? Appreciate your help in advance.

4
  • Check your url format Commented Sep 19, 2016 at 5:13
  • @KrutarthPatel: It is a valid one. The url is the same as it was in the first attempt. Commented Sep 19, 2016 at 6:37
  • Refer this link : stackoverflow.com/questions/17080335/… Commented Sep 19, 2016 at 6:40
  • 3
    Thanks for your reply. I think this is a default Safari behaviour. Since I declined the open app confirmation question, it is not allowing the app launch from then on, until you refresh the page. Commented Oct 21, 2016 at 8:13

4 Answers 4

13

It's a known behavior.

If you tap on facebook://feeds:

And open it then Safari won't blacklist the facebook scheme for that Safari tab. You would be allowed to open facebook://profile, facebook://feeds, facebook://settings, etc. on that tab

However if you click on 'Cancel' then you're no longer able to able any url with that scheme for that tab only ie you won't be able to open facebook://profile, because it's been blacklisted for that tab.

What should you do?

Open a new tab and try again. It would no longer be blacklisted for that tab.

It would have been much better though if Apple prompted its user with options like:

Deny once. Deny Always. Allow Always

But I'm guessing if they did that then they'd have to provide alternate ways for the user to customize behavior per host/scheme. Obviously Apple doesn't want to allow that.

Sign up to request clarification or add additional context in comments.

1 Comment

this was exactly my problem-- just close that tab, try again and it worked like a charm!
-1

I met the same problem when using Google Tag Manager in my code. Try the javascript event for opening the app instead of using the href of the tag a.

Comments

-1

I was getting a similar error, fixed it by allowing "Installing App" in restriction(Settings->General->Restriction), enable the toggle button. It is by default enabled but I restricted it in past by disabling the toggle button.

Hope this helps anyone.

Comments

-3

I just fixed the same problem on an iphone. Go to settings> General> Restrictions> Safari. Make sure it is "allowed" or turned on (swipe to green). Exit out of settings and retry. It should work.

1 Comment

This did not fix the issue for me. I don't have Restrictions enabled for any of my devices.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.