UIApplication.canOpenURL does not respect hidden Maps.app

Originator:koeltzsch
Number:rdar://31680034 Date Originated:18-Apr-2017 03:41 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 10.3.1
Classification:Other Bug Reproducible:Always
 
Summary:
The docs contain this sentence regarding to UIApplication.canOpenURL:

> When this method returns true, iOS guarantees that subsequent calls to the openURL(_:) method with the same URL will successfully launch an app that can handle that URL.

If however the user has Maps.app "uninstalled" (as in hidden) a subsequent call to open a URL that should open in Maps will result in nothing happening.

Here's some example code:

if UIApplication.shared.canOpenURL(URL(string: "http://maps.apple.com/?q=Dresden")!) {
            print("✅")
            UIApplication.shared.open(URL(string: "http://maps.apple.com/?q=Dresden")!, completionHandler: nil)
        } else {
            print("💥")
        }

If Maps.app is hidden a ✅will be printed and nothing else happens. This has the same results if querying for the "maps://" url scheme or if trying to open Maps via the MKMapItem API call instead of a URL.

Steps to Reproduce:
Sorry, I just threw it all into the description fiel above.	

Expected Results:
Either return false on the call to canOpenURL() (which would be the correct behavior based on the docs) or prompt the user to re"install" Maps.app.

Actual Results:
Silence :(

Version:
iOS 10.3.1

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!