强制 MapKit 仅使用缓存的地图图块/以编程方式禁用网络

发布于 2024-08-15 18:06:23 字数 314 浏览 3 评论 0原文

我们偶然发现了这样一个问题。

我们正在开发一款旅行应用程序。为了确保用户不会在我们的应用程序中花费太多漫游费,我们决定实现一个设置选项,供用户仅查看缓存的地图。因此,我们让用户决定是否要从互联网加载地图,或者想要省钱并查看缓存的地图(存储在 Library/Caches/MapTiles/MapTiles.sqlitedb 中)。

我们找不到实现这一点的方法。在这种情况下有什么方法可以以编程方式禁用网络吗?或者强制 MapKit 仅使用缓存的图块?我们考虑过以编程方式更改此选项的 APN,以强制 MapKit 离线。是否可以通过编程方式更改 APN?

谢谢你!

We have stumbled upon such a problem.

We are developing an application for travelling. To make sure the user doesn't spend much money on roaming charges in our app we decided to implement a settings option for user to view cached maps only. So we let the user decide whether he wants to load the maps from internet or he wants to save money and view cached maps (stored in Library/Caches/MapTiles/MapTiles.sqlitedb).

We can't find a way to implement this. Is there any way to disable network programmatically in this case? Or force MapKit use cached tiles only? We thought about changing APN programmatically for this option to force MapKit go offline. Is it possible to change APN programmatically?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我家小可爱 2024-08-22 18:06:23

iPhone SDK 应用程序无法访问网络适配器设置,而且我不知道 MapKit API 中没有任何内容可以让您控制其互联网使用。在这种情况下,最好的选择可能是显示警报,建议用户启用飞行模式或关闭数据漫游。

iPhone SDK apps do not have access to the network adapter settings, and I know of nothing in the MapKit API that gives you control over its Internet usage. Your best option in this case is probably to present an alert suggesting that the user enable Airplane Mode or turn off data roaming.

春夜浅 2024-08-22 18:06:23

使用openstreetmap
认为它的商业方面云制作允许离线地图

http://developers.cloudmade。 com/projects/show/iphone-sdk

帮助 iPhone 开发人员使用 OSM 地图的库
Route-me 是一个开源库,在许多 iPhone 应用程序中用于显示 OSM 地图。
CloudMade iPhone 地图库是一个开源库,提供对 CloudMade 基于 OSM 的不同尺寸和不同样式的地图图块的高级访问。
John McKerrell 将 gosmore 的路由算法移植到 iPhone 上运行,并成功生成了基本路由。目前,更复杂的路线会导致 iPhone 崩溃

use openstreetmap
think the commercial side of it Cloud-made allows offline maps

http://developers.cloudmade.com/projects/show/iphone-sdk

Libraries that help iPhone developers use OSM maps
route-me is an open-source library used in a number of iPhone applications to display OSM maps.
The CloudMade iPhone Maps Library is an open-source library that provides high-level access to CloudMade's OSM-based map tiles with different sizes and different styles.
John McKerrell has ported the routing algorithm from gosmore to run on the iPhone and has successfully generated basic routes. More complicated routes crash the iPhone at the moment

神仙妹妹 2024-08-22 18:06:23

有一些方法。一种是使用您自己的图块覆盖并在 URLForTilePath: 或 loadTileAtPath:result: 中实现缓存算法:

它适用于开放域和一些私有域。不缓存标准 Apple 地图。

另一种能够缓存所有内容的方法是子类 NSURLProtocol。有一些教程,您可能会检测到地图图像何时出现并采取相应措施

There are some ways. One is to use your own tile overlay and implement the caching algorithm either in URLForTilePath: or in loadTileAtPath:result:

It works very well with open domain and some private ones. Does not cache the standard Apple Maps.

Another way that will be able to cache everything is subclass NSURLProtocol. There are some tutorials and probably you may detect when is a map image and act accordingly

深巷少女 2024-08-22 18:06:23

谷歌地图应用程序有缓存功能... MapKit似乎没有,我认为苹果会在下一版本的SDK中添加此功能...

the google map app does the cache feature ... MapKit seem no , I think Apple will add this feature in next version SDK ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文