问题标签 [mkmapitem]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
515 浏览

c# - 单点触控的 iOS 地图

我正在使用 monotouch 使用 c# 代码创建 iOS 应用程序...我正在尝试使用以下代码来使用导航/地图应用程序:

您可以创建一个 NSDictionary 并传递与该位置有关的信息 - 例如地址、名称等。但是,我不知道如何在 c# 代码中创建和使用字典 - 我找到的所有编码示例一直是客观的...

我的全部目标是在地图应用程序中打开一个位置,并传入要显示在地图应用程序地标中的位置名称......使用 openinmaps()......

有没有办法使用 c# 代码创建这个“地址字典”,以便使用 openinmaps 函数将信息传递到地图应用程序中?

以下是一些客观 c 代码的示例:

0 投票
1 回答
14930 浏览

ios - 在 iOS 7 地图上显示路线:addOverlay 无效

我想在我的 mapView 中显示一个点对点的路线,我使用这个代码来创建路线:

这用于在地图上显示路线:

实际上这段代码什么都不做。

如果我尝试打印路线的距离,我会得到正确的值:

那么路线是对的,但我不明白为什么它没有出现在地图上!

有什么建议么?

0 投票
1 回答
2521 浏览

ios - Parsing an MKMapItem with iOS

I want access to the data in a MKMapItem object. After searching for information, I am asking the community. According to the Apple class reference, there are these properties:

  • placemark
  • isCurrentLocation
  • name
  • phone number
  • url

If I log an MKMapItem I get what appears as a JSON dictionary of dictionaries such as:

  • Address
  • structured address
  • center
  • locality
  • etc...

Many of the items contain information that I want, which are not default properties of MKMapItem. Is there a way to parse and model these items? I have tried

, which results in a crash:

[<MKMapItem 0xb02d830> valueForUndefinedKey:]: this class is not key value coding-compliant for the key address.

0 投票
1 回答
493 浏览

objective-c - MapKit:如何从 MKLocalSearchResponse 的返回值中检索公寓号

我在网上彻底搜索,但找不到任何关于此的讨论:

MapKit 搜索返回的MKLocalSearchResponse 对象是MKMapItem 的集合,其中包含搜索结果的信息,例如城市、州、国家。

单个 MKMapItem 看起来像这样(从 Xcode 快速查看对象):

我能够检索到我需要的所有信息,除了公寓号码。它包含在“subPremise”部分中,我不知道如何检索。

您可能会建议我从我可以访问的“formattedAddressLines”中检索它,但对于某些结果,该属性是空的,所以我不能依赖它。

我还尝试了“addressDictionary”属性,它包含除了公寓号码之外的所有必要信息,这对我来说非常不体贴。

0 投票
3 回答
330 浏览

ios - 在 didReceiveLocalNotification 下慢慢打开地图应用

我想做一个简单的动作,获取本地通知并打开苹果地图应用程序。当我收到通知然后滑动它时,我的应用程序首先打开,这很好。但是我需要等待大约 10 秒,然后地图应用程序就会打开。为什么会延迟?它应该是我的应用程序打开,然后地图直接打开。

0 投票
1 回答
402 浏览

ios - Xcode GeoCoding initWithCoordinate 函数在从 MapItem 读回时弄乱了 Thoroughfare 和其他 2 个字段

我想知道是否有人以前见过这种情况,我认为 Xcode 中 (initWithCoordinate) 的 GeoCoding 例程中存在一个错误,其中地址的 PlaceMark (MKPlaceMark) 被放置到 MapItem 中。

考虑下面的代码,在我通过 CLPlaceMark 将地理编码位置(即纬度/经度)返回到文本类型地址后,我循环遍历结果以将它们转换为 MKPlaceMark 并将它们存储为 MapItems,但是,在运行时,我意识到 Xcode/IOS 可以很好地复制大多数地址密钥,但是弄乱了对地址非常重要的(SubAdminArea、SubThoroughfare 和 Thoroughfare)的密钥。请看下面我的代码片段:

好吧,有了以上内容,几乎所有内容都可以正常复制,并且可以很好地提取,但是,遗憾的是,对于上面提到的 3 个键,在通过标准 (initWithCoordinate) 例程从 MKPlaceMark 复制到 MapItem 对象然后将其读回时,对于上面提到的 3 个键,我看到以下输出与输出不同(前一个 / 是“前”值,后一个是“后”值):

SubAdminArea: 'London / (null)' SubThoroughfare: '21-35 / (null)' Thoroughfare: 'Hanover Road / 21-35 Hanover Road'

我想知道是否有人看到过这个错误,或者你们是否可以提出其他建议。

另外,我尝试使用以下方法手动覆盖坏的:

但是,出现错误,因为这不起作用,不知道你们是否看到了这个。

你怎么看?

感谢和问候,

海德·萨蒂

---------------------------------------- 编辑:(2小时后)...

此外,我只是浏览了每个函数生成的字典项,才发现我对 MKMapItem 如何完全忽略 3 个元素并且只在请求时“隐藏”输出时感到震惊,因为新字典中不存在确切的值,请看下面我用来转储内容的代码:

使用上面,你可以清楚地看到字典的MI部分下,(Thoroughfare,SubThoroughfare和SubAdminArea)这3个元素没有复制到MKMapItem的字典中!,我想我会依靠手工制作的字典除非有人知道更好的东西,否则暂时将它们存储起来。

如果您遇到同样的问题,我希望这会有所帮助。

我现在不会将问题标记为“已回答”,因为我即将与 Apple 交谈以查看这是错误还是“功能”:)

亲切的问候海德

-----------------------------------------> 编辑,一小时后...

我刚刚向 Apple 提交了错误报告,参考编号:16026923,我希望尽快收到他们的消息。

0 投票
1 回答
195 浏览

ios - 单击按钮时 UIAlertView 静默崩溃

我有一个以 MKMapView 作为其子视图的视图。由于我的地图空间不大,我阻止了与地图的所有交互,例如滚动、缩放等。相反,当用户点击地图时(实际上他点击了地图上的一个不可见按钮),我使用位置设置。这工作正常。

didTapOverlayButton 导致它被执行:

现在我不想在没有警告他的情况下将用户踢出我的应用程序并打开另一个应用程序,所以我添加了一个 UIAlertView。现在 didTapOverlayButton 看起来像这样:

现在,当我单击其中一个按钮时,我的应用程序将关闭(如果我单击“是”,它将打开地图,但仍会关闭)。没有显示错误,日志中没有任何内容,没有内存警告。self(警报视图的委托)未发布,我的类被声明为符合 UIAlertViewDelegate 协议。

我的委托人的方法:

在 iOS 6 和 7 上测试。

编辑:我在控制台中得到这个:

2 月 20 日 16:14:31 iPhone-Devices com.apple.debugserver-300.2[6048] : 1 +0.000000 sec [17a0/1307]: error: ::read (-1, 0x3169ec, 18446744069414585344) => -1 err =错误的文件描述符 (0x00000009)

2 月 20 日 16:14:31 iPhone-Devices com.apple.debugserver-300.2[6048]:退出。

0 投票
2 回答
1710 浏览

objective-c - MKAnnotation 或 MKMapItem

MKAnnotation和有什么区别MKMapItem

当我想在我的地图上显示一些有趣的地方时,应该使用哪一个?我有
一个对象列表,到目前为止latitude,我希望将它们放在我的地图上。longitudetitledescriptionphoto

0 投票
1 回答
565 浏览

ios - Adding custom objects to a Parse backend iOS

I am building an application that stores locations in a list and later maps them.

The problem I'm running into is an inability to save MKMapItems to a Parse database. I need to save these MKMapItems because they are the only unique identifiers for locations on a map that would not require searching the map again (ex.location name, ex. address).

So my question is, how can I save an MKMapItem to a Parse database?

And to follow up, if it is not possible to save an MKMapItem, how else can I save these items to a map so that I do not have to re-search?

MKMapItem: https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapItem_class/Reference/Reference.html

Parse: https://www.parse.com/docs/ios_guide#top/iOS

EDIT

Another detail that might help: I'm using this to store information about particular venues. For example restaurants. I don't necessarily want to be creating a new map annotations at that mark if I can avoid it.

0 投票
2 回答
390 浏览

ios - 找到给定 MKMapItems 的最小可能边界区域

我有一个 MKMapItems 数组,我试图找到可以插入边界区域的坐标,这将使包含所有 MKMapItems 的地图放大最多

这些地图项中的每一个都有坐标,因此通过一些简单的边界计算可以找到 4 个角。我正在寻找一个已经定义的函数,如果它可用的话。

如果还没有预定义的函数,任何帮助确定给定点集的适当跨度值也将不胜感激!

提前致谢!