gpt4 book ai didi

ios - Ray Wenderlich 的 Mapkit 教程中的 SIGABRT

转载 作者:行者123 更新时间:2023-11-29 04:13:41 25 4
gpt4 key购买 nike

所以我正在按照 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com