Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep getting alert view message of "Open this page in YourAppName?" when trying to launch app from safari

I need to be able to launch my iOS app from the Safari browser. So I went to my .plist file in xcode and added an item to my URL Schemes and entered in the string of myappname.

Now if I go to Safari, and type myappname:// in the URL address bar and submit it, it shows me a UIAlertView that says Open this page in "MyAppName"? with options for Cancel and Open.

If I tap Open it successfully opens my app, however I want to do this without the UIAlertView popping up with that message.

I have done some quick searching online and it looks like people keep having trouble with this whenever a new iOS update comes out and I can't seem to find a recent solution or answer.

I am on an iPhone 4s with iOS 7.1, and I'm using xcode 5.1 if that makes any difference.

Also, I have been using an app available in the App Store called "Frontback" that successfully does this same thing without the UIAlertView showing in Safari so this is definitely possible.

Thanks for the help.

like image 275
user3344977 Avatar asked Apr 01 '14 19:04

user3344977


1 Answers

I use this method in my app without getting a UIAlertView. It just goes straight to the app.

I had a similar issue when I first started implementing it. I suspect that it's not a problem with myappname://, but possibly a problem with how you added the URL Scheme.

Make sure to assign your custom value (myappname) to the URL Identifier object (com.mycompany.myappname). The URL identifier should be a String and the URL Schemes should be an array with your custom value being a String.

The XML version of your .plist should look like this:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.mycompany.myappname</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myappname</string>
        </array>
    </dict>
</array>   
like image 169
Wapiti Avatar answered Nov 15 '22 04:11

Wapiti