How to check if Apple Maps is installed

可紊 提交于 2019-12-01 02:32:54

The simple answer is this is not currently possible.

The reason is that Apple Maps application is not deleted, only application icon is removed from home screen (see Mike D comment).

Custom url of this app (maps://) is still registered, so sharedApplication can open this url. But when you try to open this url and app icon is removed from home screen, user is notified about restoring the application through AppStore. When user wants to restore app, it is restored immediately (nothing is downloaded).

Result of MKMapItem.openMaps means only user decision if he wants to open Apple Maps.

IMHO Apple Maps cannot be regularly uninstalled because their data are being reused by other applications.

In the current version i.e. 11.2, it appears you are able to remove Apple Maps from your phone. But unfortunately, if you do something like:

 if (UIApplication.shared.canOpenURL(URL(string: "maps://")!)) {
        //do whatever you need to do here.
 }

it still returns true.

But it does handle navigation gracefully anyway. In my case I am providing the user a chooser between Apple Maps and Google Maps. When Apple Maps is not present it provides me with this, IMHO, this is fine because the user is not navigated away from the app and can choose a different option if they want to:

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