开发者

iPhone: MKMapView Strange crash

I'm having an issue with a MKMapView, hope someone can help me.

I have a view that embed a MKMapView and a navigationController. I push in my navigationController another viewController then another one again. Then if I go back to the MKMapView and touch the map, the application crash. so MkmapView > View2 > View3 > View2 > MKMapView > touch on the map then crash.

I definitely don't understand why. If I only push another view then come back, it works well. So: MkmapView > View2 > MKMapView = OK

I Use the other views in the same way in another part of the application without any problem. View1 > View2 > View3 > View2 > View1 = OK

I checked, no memory warning viewDidUnload or dealloc method are called.

The er开发者_运维知识库ror is: *** -[NSURL length]: unrecognized selector sent to instance 0x4806930

This time it was an NSURL that crashed but it's almost all the time different: NSArray, NSDictionnary etc...

Here is the stack trace:

0    0x3266bdf4 in objc_exception_throw

1    0x32de2bfc in -[NSObject doesNotRecognizeSelector:]

2    0x32d67b18 in ___forwarding___

3    0x32d5e840 in __forwarding_prep_0___

4    0x32cec074 in -[MKOverlayView _annotationViewForSelectionAtPoint:avoidCurrent:]

5    0x32ce4b60 in -[MKOverlayView annotationViewForPoint:]

6    0x32cc7efc in -[MKMapView _firstTouchBegan:withEvent:]

7    0x32d17e28 in -[MKScrollView _firstTouchBegan:withEvent:]

8    0x32d17c98 in -[MKScrollView touchesBegan:withEvent:]

9    0x30c4a888 in -[UIWindow _sendTouchesForEvent:]

10    0x30c49f94 in -[UIWindow sendEvent:]

11    0x30c45790 in -[UIApplication sendEvent:]

12    0x30c45094 in _UIApplicationHandleEvent

13    0x31bba990 in PurpleEventCallback

14    0x32da452a in CFRunLoopRunSpecific

15    0x32da3c1e in CFRunLoopRunInMode

16    0x31bb9374 in GSEventRunModal

17    0x30bf3c30 in -[UIApplication _run]

18    0x30bf2230 in UIApplicationMain

19    0x000025f8 in main at main.m:14

Does anyone had same kind of issue ? Can someone give me advices on how I could locate the bug or what I should check ?

Thanks for your time!


Your map view has an annotation. If you set a breakpoint in your annotation's -title method you will get that same stack trace when you touch the map.

Your annotation is getting released prematurely.


Make sure to use MKMapView.delegate=nil before u release the MKMapView object in dealloc method.This is important for iOS 3.0, not imperative in higher versions.


Try turning on zombies. What's probably happening here is that an NSURL object is being deallocated, and something else is being created at the same address.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜