- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我正在按照 Ray Wenderlich 的 Mapkit 教程找到 here 。我被困在我应该使用 plotCrimePositions
方法在 map 上绘制犯罪图的部分。使用调试器,我已将范围缩小到创建 NSDictionary* root 的位置,但似乎无法找到错误。任何帮助将不胜感激。 Here is a gist with relevant files.
谢谢!
编辑:这是我的控制台日志:
2012-12-23 16:31:52.925 MapTutorial[8993:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
*** First throw call stack:
(0x1850012 0x1645e7e 0x184fdeb 0x117a817 0x34697 0x35153 0x1659705 0x590920 0x7ccb24 0x1659705 0x590920 0x5908b8 0x651671 0x651bcf 0x650d38 0x5c033f 0x5c0552 0x59e3aa 0x58fcf8 0x223bdf9 0x223bad0 0x17c5bf5 0x17c5962 0x17f6bb6 0x17f5f44 0x17f5e1b 0x223a7e3 0x223a668 0x58d65c 0x341cd 0x2945)
libc++abi.dylib: terminate called throwing an exception
最佳答案
您的问题在这里:
- (IBAction)refreshTapped:(id)sender{
//...
[request startAsynchronous]; //Start the request
[self plotCrimePositions:request.responseData]; //Assume there's data,
//despite the request not even have been given a chance to start
}
因为你假设你的request
将同步执行,然后到达 plotCrimePositions:
当它完成时,你假设请求得到的数据非零(显然不是这样),这导致 MapKit 崩溃。如果您搬家[self plotCrimePositions:request.responseData];
进入您指定的完成处理程序的范围,它应该像魅力一样工作。异步请求是异步的:这意味着它们立即返回,这就是为什么完成 block 是如此的天赐之物。
关于ios - Ray Wenderlich 的 Mapkit 教程中的 SIGABRT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14014885/
我想在我的应用程序中显示 map 上两点之间的点对点路线。我正在使用 MKDirectionsRequest为此。我试图找到浦那到孟买之间的路线。我收到一个错误作为响应。 错误消息: Error Do
我想我可能在 iOS 6 的 mapkit API 中发现了一个错误,但由于我仍然认为自己是新手,我想我会在这里查看是否有人能指出我可能做错的事情。 我有一个应用程序已经工作了几个星期,其中有一个 m
这是我的第一个程序。而且,我正在实现 MapKit。以下是代码: import UIKit import MapKit class ViewController: UIViewController {
如何从 MapkitView 获取当前可见叠加层的列表(数组)? 背景 - 例如,我想在我的 mapkitview 上显示指向某些覆盖类型中心的方向箭头,但是如何获得可见的箭头?我看似乎没有办法做到这
我使用了 Apples WWDC 2017 的项目 tandm - 237“Mapkit 中的新功能”。 已经有一个带数组的data.plist命名的自行车和额外的词典有四个项目(键:值 - 对)。
我正在使用 iOS 11 集群,它工作得很好,基本上你只需要将标识符添加到 MKAnnotationView 的 clusteringIdentifier 属性。 一切正常,但我有一个问题,当用户从
我有一个MKMapView,在顶部有一个UISearchBar,我希望用户能够键入一个地址,并找到该地址并在其上放一个别针。我不知道如何将地址字符串转换为经度和纬度,因此我可以创建一个CLLocati
我想在 map 上画一条路线。 但不使用委托(delegate)的结构。 struct MapView : UIViewRepresentable { } func mapView(_ mapView
绘制的折线显示在建筑物下方。 如何使折线位于所有图层的顶部 请建议 将折线添加为 var coordinates = locationsArrToAdd.map({ (location: CLL
我有一个简单的 Mac 应用程序,不打算用于任何类型的分发;只是个人使用。该应用程序是 NSWindow其中包含一个 MKMapView .由于我没有 Mac 开发人员帐户,也不想要(请参阅“仅供个人
这是一个非常简单的问题。在 MapKit JS 中,如何将注释设置为选中的注释? 我已经在 map View 上有了注释并且可以访问我想要选择的注释。我觉得应该有一个类似于 MapKit 的方法(不是
我可以在我的应用程序中使用 Google map 街景吗? 最佳答案 不。 [填充字符以克服可疑的最小值] 关于xcode - MapKit 是否允许街景?,我们在Stack Overflow上找到一
我有一个功能,可以将注释放大到 map 上的一半,以及用户的位置,这样两者都可以在屏幕上看到。是否有显示其“内容”的注释方法,即模拟按下它?它在放大后立即弹出是理想的选择。 提前致谢。 最佳答案 您可
在我的应用程序中,我添加了很多引脚,并在 viewForAnnotaion 中,我在 MKPinAnnotaionView 上设置了 animatesDrop=TRUE。问题是,当有 200 多个引脚
我已经为此苦苦挣扎了几天,我什至重写了一半的代码来尝试另一种方式。 我从 csv 导入了注释,并用图 block 和副标题放置在 map 上,我徒劳地尝试添加一个标签来公开按钮,以便我可以看到点击了哪
我按照本教程制作了我的第一个应用程序: http://icodeblog.com/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/ 我真的很想知道
我是 iPhone 开发新手。我在 map 上添加了注释。我能够在 didSelectAnnotationView() 中捕获注释上的点击事件。但我想在用户点击注释时更改注释的图像。 最佳答案 设置图
所以我的 map 上散布了一堆注释...一切都很漂亮。现在我需要能够设置 map 的位置和缩放,以便它们完美契合。我怎样才能做到这一点? 最佳答案 来自苹果论坛... - (void)recenter
我是 iPhone 版 MapKit 的新手,尝试实现此功能,由于某种原因我看不到当前位置蓝点,其他人也有这个问题吗??? #import "DetailMapViewController.h" #i
我有一张显示多个注释的 map 。我想模仿“照片”内置应用程序(iOS 4)上“位置”选项卡的行为,其中当用户更改缩放级别时,注释会自动连接在一起或分开。 我该怎么做? 谢谢! 最佳答案 “照片”应用
我是一名优秀的程序员,十分优秀!