MKMapAnnotation crash

Discussion in 'iOS Programming' started by mpramodjain, Dec 16, 2010.

  1. mpramodjain macrumors regular

    Joined:
    Nov 20, 2008
    Location:
    Banglore
    #1
    Hi,

    I am getting following error when I release my MKMapView object.

    [MKMapAnnotation dealloc]
    [NSObject release]

    Did any had faced this type of issue, if so what would be work round on this.
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    If that's really your code, then it's completely wrong.

    1. You should never call dealloc on any object except super. When you release ownership of an object, call release.

    2. You should never call release or dealloc on a class. Both MKMapAnnotation and NSObject are classes.

    Read this:
    http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html

    It's essential that you understand everything in that memory management guide. It's impossible to write well-behaved programs if you don't understand how it works and what your program should do to manage memory properly.
     
  3. mpramodjain thread starter macrumors regular

    Joined:
    Nov 20, 2008
    Location:
    Banglore
    #3
    Hi Chown,

    Thanks for your quick reply,,
    Sorry for the incomplete info.
    Actually the above mentioned was not the code I developed, it was a crash report I got in the Backtrace, when I release MKMapView. Clear crash reports are as follows,

    First Crash report

    #0 0x9246d176 in __kill ()
    #1 0x9246d168 in kill$UNIX2003 ()
    #2 0x924ff89d in raise ()
    #3 0x925159bc in abort ()
    #4 0x92412b75 in free ()
    #5 0x01407c7d in _internal_object_dispose ()
    #6 0x0155e5fb in -[NSObject(NSObject) dealloc] ()
    #7 0x00021a4b in -[CSMapAnnotation dealloc] (self=0xa559e10, _cmd=0x16499d6) at /Users/valuelabs/Desktop/Pramod Jain_Dec2/Castrol/Working Code/Castrol/Classes/CSMapAnnotation.m:57
    #8 0x0152aa6c in CFRelease ()
    #9 0x0153f804 in __CFBasicHashDrain ()
    #10 0x0152abcb in _CFRelease ()
    #11 0x00e96498 in -[MKAnnotationContainerView dealloc] ()
    #12 0x004b79d9 in -[UIView dealloc] ()
    #13 0x004c1281 in -[UIScrollView dealloc] ()
    #14 0x00ecd47d in -[MKScrollView dealloc] ()
    #15 0x004af512 in -[UIViewAnimationState animationDidStop:finished:] ()
    #16 0x0108f6cb in run_animation_callbacks ()
    #17 0x0108f589 in CA::timer_callback ()
    #18 0x015f4fe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
    #19 0x015f6594 in __CFRunLoopDoTimer ()
    #20 0x01552cc9 in __CFRunLoopRun ()
    #21 0x01552240 in CFRunLoopRunSpecific ()
    #22 0x01552161 in CFRunLoopRunInMode ()

    Second Crash Report



    gdb) bt
    #0 0x01415a63 in objc_msgSend ()
    #1 0x00000001 in ?? ()
    #2 0x0153f804 in __CFBasicHashDrain ()
    #3 0x0152abcb in _CFRelease ()
    #4 0x00e96498 in -[MKAnnotationContainerView dealloc] ()
    #5 0x004b79d9 in -[UIView dealloc] ()
    #6 0x004c1281 in -[UIScrollView dealloc] ()
    #7 0x00ecd47d in -[MKScrollView dealloc] ()
    #8 0x004af512 in -[UIViewAnimationState animationDidStop:finished:] ()
    #9 0x0108f6cb in run_animation_callbacks ()
    #10 0x0108f589 in CA::timer_callback ()
    #11 0x015f4fe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
    #12 0x015f6594 in __CFRunLoopDoTimer ()
    #13 0x01552cc9 in __CFRunLoopRun ()
    #14 0x01552240 in CFRunLoopRunSpecific ()
    #15 0x01552161 in CFRunLoopRunInMode ()
    #16 0x01ad8268 in GSEventRunModal ()
    #17 0x01ad832d in GSEventRun ()
    #18 0x0048d42e in UIApplicationMain ()
    #19 0x00002822 in main (argc=1, argv=0xbfffeef4) at /Users/valuelabs/Desktop/Pramod Jain_Dec2/Castrol/Working Code/Castrol/main.m:14
    kill
    quit

    Thanks in advance.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Can we see the code?
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    The stack traces seem to indicate that the mapview is still animating when it is released and something that the animation depends on has been released before the animations complete. I haven't used the mapviews but is there a way to tell it to stop animating or to nil a delegate before you release the mapview?
     
  6. mpramodjain thread starter macrumors regular

    Joined:
    Nov 20, 2008
    Location:
    Banglore
    #6
    Thanks all for the replies.

    We are able to track the reason for crash.

    Reason : It was silly , multiple release of an MKMapAnnotation autorelease object.
     

Share This Page