MKReverseGeocoder 导致 EXC_BAD_ACCESS?
我有一个应用程序出现间歇性崩溃。崩溃日志显示了一个堆栈跟踪,这对我来说很难破译,因此希望其他人看到了这一点并能为我指明正确的方向。
基本上,该应用程序在启动时执行反向地理编码请求,以在标签中显示用户的位置。此外,我还对特定 API 调用执行另一个反向地理编码请求。
发生的情况是,有时这个 MKReverseGeocoder 需要很长时间才能返回。最终我假设我会收到失败回调,有时确实如此,但可能需要几分钟才能发生这种情况。
由于API调用还发出另一个MKReverseGeocoder请求,我认为多个并发调用可能存在问题?
这是我的堆栈跟踪:
Program received signal: “EXC_BAD_ACCESS”.
(gdb) backtrace
#0 0x30c237a0 in -[MKPlacemark _mapkit_cache_heapTime] ()
#1 0x30bffe60 in compareTimes ()
#2 0x32403b24 in CFBinaryHeapAddValue ()
#3 0x30c0030c in -[MKCache setObject:forKey:] ()
#4 0x30c2aa48 in -[MKReverseGeocodeCache addPlacemark:forCoordinate:] ()
#5 0x30c2251c in -[MKReverseGeocoder requester:didReceiveResponse:forRequest:] ()
#6 0x3388cc1c in -[PBRequester _tryParseData] ()
#7 0x3388b288 in -[PBRequester connection:didReceiveData:] ()
#8 0x337490ce in -[NSURLConnection(NSURLConnectionReallyInternal) sendDidReceiveData:originalLength:] ()
#9 0x33748ff0 in _NSURLConnectionDidReceiveData ()
#10 0x30899ff8 in URLConnectionClient::_clientDidReceiveData ()
#11 0x3088ca3e in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
#12 0x3088cb40 in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
#13 0x3088cb40 in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
#14 0x3088c8ce in URLConnectionClient::processEvents ()
#15 0x3088c878 in URLConnection::multiplexerClientPerform ()
#16 0x3088c7f8 in MultiplexerSource::perform ()
#17 0x3088c798 in MultiplexerSource::_perform ()
#18 0x323f4f48 in CFRunLoopRunSpecific ()
#19 0x323f4c1e in CFRunLoopRunInMode ()
#20 0x335051c8 in GSEventRunModal ()
#21 0x324a6c30 in -[UIApplication _run] ()
#22 0x324a5230 in UIApplicationMain ()
#23 0x000024f8 in main (argc=1, argv=0x2ffff504) at /Users/ben/projects/ABC/iphone/ABC/main.m:14
因为它看起来甚至没有调用我的回调方法,所以我不知道在哪里寻找此 EXC_BAD_ACCESS 问题。我的委托当然仍然处于活动状态(我盯着发起请求的视图控制器)。
1 最后说明:到目前为止它只出现在 iOS 3.1.3 上。我还没有看到 iOS 4.0 发生这种情况。u
I have an app that is exhibiting an intermittent crash. The crash logs are showing a stack trace that is tough for me to decipher, so hoping that someone else has seen this and can point me in the right direction.
Basically the app does a reverse geocoding request at startup to show the user's location in a label. Additionally, I do another reverse geocoding request for a specific API call.
What's happening is that sometimes this MKReverseGeocoder takes a really long time to come back. Eventually I assume that I'll get a failure callback, and sometimes I do, but it can be minutes before this happens.
Since the API call is also issuing another MKReverseGeocoder request, I think perhaps there is an issue with multiple concurrent calls?
Here is my stacktrace:
Program received signal: “EXC_BAD_ACCESS”.
(gdb) backtrace
#0 0x30c237a0 in -[MKPlacemark _mapkit_cache_heapTime] ()
#1 0x30bffe60 in compareTimes ()
#2 0x32403b24 in CFBinaryHeapAddValue ()
#3 0x30c0030c in -[MKCache setObject:forKey:] ()
#4 0x30c2aa48 in -[MKReverseGeocodeCache addPlacemark:forCoordinate:] ()
#5 0x30c2251c in -[MKReverseGeocoder requester:didReceiveResponse:forRequest:] ()
#6 0x3388cc1c in -[PBRequester _tryParseData] ()
#7 0x3388b288 in -[PBRequester connection:didReceiveData:] ()
#8 0x337490ce in -[NSURLConnection(NSURLConnectionReallyInternal) sendDidReceiveData:originalLength:] ()
#9 0x33748ff0 in _NSURLConnectionDidReceiveData ()
#10 0x30899ff8 in URLConnectionClient::_clientDidReceiveData ()
#11 0x3088ca3e in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
#12 0x3088cb40 in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
#13 0x3088cb40 in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
#14 0x3088c8ce in URLConnectionClient::processEvents ()
#15 0x3088c878 in URLConnection::multiplexerClientPerform ()
#16 0x3088c7f8 in MultiplexerSource::perform ()
#17 0x3088c798 in MultiplexerSource::_perform ()
#18 0x323f4f48 in CFRunLoopRunSpecific ()
#19 0x323f4c1e in CFRunLoopRunInMode ()
#20 0x335051c8 in GSEventRunModal ()
#21 0x324a6c30 in -[UIApplication _run] ()
#22 0x324a5230 in UIApplicationMain ()
#23 0x000024f8 in main (argc=1, argv=0x2ffff504) at /Users/ben/projects/ABC/iphone/ABC/main.m:14
Since it doesn't look like it's even calling my callback method I don't know where to look for this EXC_BAD_ACCESS issue. My delegate is certainly still active (I'm staring at the View Controller that launched the request).
1 last note: It has only appeared so far on iOS 3.1.3. I haven't seen it happen for iOS 4.0 yet.u
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 xcode 配置文件中的 Zombies 工具。这将帮助您找到导致 EXC_BAD_ACCESS 的对象内存。
Try to use Zombies instrument from the xcode profile. This will help you to find which object memory causing the EXC_BAD_ACCESS.
这是一个用于反向地理编码的谷歌 API 文档,它返回 JSON 以及 XML 输出,并且它是值得信赖且稳定的 API。
http://code.google.com/apis/maps/documentation/geocoding/
例如,此 url 提供 JSON 输出,因此使用它可以解决您的问题。让我知道它是否适合您?
http://maps.googleapis.com /maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false
Here is a google API document for Reverse Geocoding which returns JSON as well as XML output and it's trustable and stable api.
http://code.google.com/apis/maps/documentation/geocoding/
for Example this url provides JSON output so using this you can solve your problem.Let me know will it work for you or not?
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false