Routing Data for MKMapKit in iOS6

核能气质少年 提交于 2019-12-06 07:43:26

问题


I have done routing in iOS apps before, but with iOS6 we are now displaying Apple maps - which causes a problem because we are using Google routing data and if we use Google data, we are supposed to be displaying it on a Google map.

I have been searching but as far as I can tell, Apple does not provide any routing data. The closest thing to an answer so far seems to be when Apple says Apps that consume direction information do so by sending an appropriate request to the Maps app, which then handles the task of displaying that information to the user. - which, to me, means that the Maps app would be opened to display the route, and taking the user out of our app.

  • Where can we get on-the-fly routing data that is acceptable to use on iOS6 apps using Apple's maps?

回答1:


You could use MapQuest's Open Directions API. It is free and it does not seem to have any limit. They also have a licensed API with a free daily limit.

I believe you are only required to put their logo somewhere on your app.




回答2:


Unfortunately MapKit does not provide routing data.

In iOS 6 and later, Map Kit offers support for providing map-based directions to the user. Apps can be a provider of directions or they can use the Maps app itself to provide directions. Apps that consume direction information do so by sending an appropriate request to the Maps app, which then handles the task of displaying that information to the user. However, if you are implementing a navigation app of your own, you can register your app as a routing app—that is, a provider of directions. When the Maps app receives direction requests from the user (or other apps), it can then forward those requests to your app for display.

Source

So, your best bet here is to use external routing data, or the maps app. Since Google prohibits using their routing data without displaying on a Google map, you may want to check the bing API's (here). It is not immediately apparent that they require you to use bing maps with the bing routing data, but they do also provide a static map api as well (here).

Alternately, you may want to look at this project on github. It shows how to load google map tiles in a map view.

Best of luck.




回答3:


Apple may provide routing information in the future, but for now it's only available in the Maps app.

One solution is to use Google tiles in your map view. The code for ClassicMap has a complete implementation of this, and is available with a liberal license. Use it as a stopgap until Apple provides routing information.




回答4:


You are correct, the Google API terms of service state in 10.1.1 point g:

(g) No Use of Content without a Google Map. You must not use or display the Content without a corresponding Google map, unless you are explicitly permitted to do so in the Maps APIs Documentation, or through written permission from Google. In any event, you must not use or display the Content on or in conjunction with a non-Google map. For example, you must not use geocodes obtained through the Service in conjunction with a non-Google map. As another example, you must not display Street View imagery alongside a non-Google map, but you may display Street View imagery without a corresponding Google map because the Maps APIs Documentation explicitly permits you to do so.

The access to the Google APIs was until iOS 6 transparent and accessed via the MapKit framework by Apple, who handled all the licensing, fees etc for us the developers, we didn't need to worry about this.

Now that Apple are using their own mapping service, we don't have access to Google APIs via the MapKit framework, like you say, and routing isn't possible with MapKit in the way you want to use it.

So you must keep the communication with Google, but the problem is now you will be using Google data without a Google Map.

This is a problem, and if your app's popular, and Google realise, they may choose to make a problem with you.

There isn't a correct way around it for now, some apps are tiling Google maps onto Apple maps, but then you will need to register your app with Google for an API key I assume, which limits your number of requests and potentially you may have to pay Google for the API usage.



来源:https://stackoverflow.com/questions/12753580/routing-data-for-mkmapkit-in-ios6

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