Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
Hello,
my App crashes and I do not understand how to read the crash report in order to understand what the problem is. I assume I have over released some object, but I do not find it. This is how I did so far:
-> open up the organizer in xcode
-> open up the current crash report

The report says:
Code:
Incident Identifier: 1520A904-0F01-4F83-8F46-95892F1B5804
CrashReporter Key:   f27f4375b1d6496b0b0dae97d15a0317b7c57ef9
Process:         myApp1.0 [13232]
Path:            /var/mobile/Applications/648D077E-B953-4CCC-89B4-7177E1FFC439/UlmApp1.0.app/myApp1.0
Identifier:      myApp1.0
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-05-03 10:28:02.541 +0200
OS Version:      iPhone OS 3.1.3 (7E18)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x74000042
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib               	0x00003ec0 objc_msgSend + 24
1   MapKit                        	0x000729b8 -[MKDotBounceAnimation animationDidStop:finished:] + 248
2   QuartzCore                    	0x0001e05c run_animation_callbacks(double, void*) + 440
3   QuartzCore                    	0x0001de64 CA::timer_callback(__CFRunLoopTimer*, void*) + 156
4   CoreFoundation                	0x000574bc CFRunLoopRunSpecific + 2192
5   CoreFoundation                	0x00056c18 CFRunLoopRunInMode + 44
6   GraphicsServices              	0x000041c0 GSEventRunModal + 188
7   UIKit                         	0x00003c28 -[UIApplication _run] + 552
8   UIKit                         	0x00002228 UIApplicationMain + 960
9   myApp1.0                     	0x00002a96 0x1000 + 6806
10  myApp1.0                     	0x00002a40 0x1000 + 6720

Thread 1:
0   libSystem.B.dylib             	0x00001488 mach_msg_trap + 20
1   libSystem.B.dylib             	0x00004064 mach_msg + 60
2   CoreFoundation                	0x00057002 CFRunLoopRunSpecific + 982
3   CoreFoundation                	0x00056c18 CFRunLoopRunInMode + 44
4   WebCore                       	0x000841d4 RunWebThread(void*) + 412
5   libSystem.B.dylib             	0x0002b780 _pthread_body + 20

Thread 2:
0   libSystem.B.dylib             	0x00001488 mach_msg_trap + 20
1   libSystem.B.dylib             	0x00004064 mach_msg + 60
2   CoreFoundation                	0x00057002 CFRunLoopRunSpecific + 982
3   CoreFoundation                	0x00056c18 CFRunLoopRunInMode + 44
4   Foundation                    	0x0005a998 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 172
5   Foundation                    	0x00053ac6 -[NSThread main] + 42
6   Foundation                    	0x00001d0e __NSThread__main__ + 852
7   libSystem.B.dylib             	0x0002b780 _pthread_body + 20

Thread 3:
0   libSystem.B.dylib             	0x000262c0 select$DARWIN_EXTSN + 20
1   CoreFoundation                	0x000207e2 __CFSocketManager + 342
2   libSystem.B.dylib             	0x0002b780 _pthread_body + 20

Thread 4:
0   libSystem.B.dylib             	0x00001488 mach_msg_trap + 20
1   libSystem.B.dylib             	0x00004064 mach_msg + 60
2   CoreFoundation                	0x00057002 CFRunLoopRunSpecific + 982
3   CoreFoundation                	0x00056c18 CFRunLoopRunInMode + 44
4   GMM                           	0x00008dec GMM::TileCachePrivate::runCacheThread() + 592
5   GMM                           	0x00008e48 _runCacheThread(void*) + 4
6   libSystem.B.dylib             	0x0002b780 _pthread_body + 20

Thread 0 crashed with ARM Thread State:
    r0: 0x001a7b80    r1: 0x32d7cbe0      r2: 0x318e2254      r3: 0x00000004
    r4: 0x001b90b7    r5: 0x74000042      r6: 0x001ab310      r7: 0x2ffff4a4
    r8: 0x38282494    r9: 0x7fffffff     r10: 0x00106ca0     r11: 0x00106d90
    ip: 0x3826e7f4    sp: 0x2ffff484      lr: 0x318c49c0      pc: 0x33369ec0
  cpsr: 0x200f0010

Any advices on how to intepret this?
Thanks in advance!
MACloop
 

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany

I made some research on the internet and found this which is describing my problem. The question - is this a known bug by mapkit? My app behaves as described in the post, by sometimes crash when going back in a navigation controller having a map opened. I ahve also noticed that it is even more untabile when the
Code:
map.showUserlocation=YES;
is set.

Anyone having any ideas about this bug?
Thanks in advance!
MACloop
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
I'm not familiar with this bug. However, the crash in objC_msgsend is usually caused by messaging an object that has been released. Apparently the crash is caused by an object going away that is still referenced by an animationDidStop selector. I guess this object is the delegate of the mapView.

The crash would only happen if the delegate is dealloced while the animation is still active.

If setting the mapView's delegate to nil doesn't fix this, it might not if the animation is already in progress, there are probably other ways to avoid the problem but they would be a little complicated.

In general delegates must live past the lifetime of the delegee. And this rule must be enforced in your code, not the code of the delegee.

I can't tell from the info on the web whether the delegate is the mapview itself or some other object. At any rate delaying the release of the mapview or never releasing it seems like it should work.
 

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
I'm not familiar with this bug. However, the crash in objC_msgsend is usually caused by messaging an object that has been released. Apparently the crash is caused by an object going away that is still referenced by an animationDidStop selector. I guess this object is the delegate of the mapView.

The crash would only happen if the delegate is dealloced while the animation is still active.

If setting the mapView's delegate to nil doesn't fix this, it might not if the animation is already in progress, there are probably other ways to avoid the problem but they would be a little complicated.

In general delegates must live past the lifetime of the delegee. And this rule must be enforced in your code, not the code of the delegee.

I can't tell from the info on the web whether the delegate is the mapview itself or some other object. At any rate delaying the release of the mapview or never releasing it seems like it should work.

Thanks for your comments! Well, I will go through my code once again to see if I over retain somewhere. I do not think so thou because it happens not only in one viewcontroller but in many and it apperas in different situations. Worst is when the user position is set in the map view...

As it seems it the problem when I click the back button before the map is ready somehow... Well, thanks alot for your comments - it helps alot to get some input like this when trying to find an error!
MACloop
 

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
I'm not familiar with this bug. However, the crash in objC_msgsend is usually caused by messaging an object that has been released. Apparently the crash is caused by an object going away that is still referenced by an animationDidStop selector. I guess this object is the delegate of the mapView.

The crash would only happen if the delegate is dealloced while the animation is still active.

If setting the mapView's delegate to nil doesn't fix this, it might not if the animation is already in progress, there are probably other ways to avoid the problem but they would be a little complicated.

In general delegates must live past the lifetime of the delegee. And this rule must be enforced in your code, not the code of the delegee.

I can't tell from the info on the web whether the delegate is the mapview itself or some other object. At any rate delaying the release of the mapview or never releasing it seems like it should work.

Thanks for your comments! Well, I will go through my code once again to see if I over retain somewhere. I do not think so thou because it happens not only in one viewcontroller but in many and it apperas in different situations. Worst is when the user position is set in the map view...

As it seems it the problem when I click the back button before the map is ready somehow... Well, thanks alot for your comments - it helps alot to get some input like this when trying to find an error!
MACloop
 

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
The crash would only happen if the delegate is dealloced while the animation is still active.
How can I detect that?

If setting the mapView's delegate to nil doesn't fix this, it might not if the animation is already in progress, there are probably other ways to avoid the problem but they would be a little complicated.
What complicated ways are you thinking about? I think I have to try it out.

I can't tell from the info on the web whether the delegate is the mapview itself or some other object. At any rate delaying the release of the mapview or never releasing it seems like it should work.
In my case the delegate is set in the xib file as to be the files owner. I have implemented it without release retain now and it is working better, but not good enough :-( When I move the map fast and then immediately click on back, the app crashes...
I really do not know what to do... any advices?
Thanks in advance!
MACloop
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Aside from the blog post you mention there was a similar post on the Apple iPhone forum. It was suggested that the bug has been fixed in 3.2. You might want to check this on 3.2 or 4.0 if you can.

Apparently it is a bug in MKMapView. The animation delegate is the map view itself. So the problem is that the mapview may be released while an animation is still in progress. When the animation ends the selectorDidEnd message is sent to a view that no longer exists.

One simple solution would be to never release the view controller that hosts the map view. Create it lazily, retain it, and then reuse it. Don't ever release it.

One of the solutions posted on the web is to use a delayed perform of 4 seconds to delay releasing the mapview. That might work but seems like it might not work in some cases.

One problem with all this is that there's not a simple way to tell if an animation exists or to receive a notification when an animation ends that your code didn't create.

Regarding, removeAllAnimations, that might work. But you need to add QuartzCore.framework to your project and import CALayer.h to gain access to it.
 

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
Aside from the blog post you mention there was a similar post on the Apple iPhone forum. It was suggested that the bug has been fixed in 3.2. You might want to check this on 3.2 or 4.0 if you can.

Apparently it is a bug in MKMapView. The animation delegate is the map view itself. So the problem is that the mapview may be released while an animation is still in progress. When the animation ends the selectorDidEnd message is sent to a view that no longer exists.

One simple solution would be to never release the view controller that hosts the map view. Create it lazily, retain it, and then reuse it. Don't ever release it.

One of the solutions posted on the web is to use a delayed perform of 4 seconds to delay releasing the mapview. That might work but seems like it might not work in some cases.

One problem with all this is that there's not a simple way to tell if an animation exists or to receive a notification when an animation ends that your code didn't create.

Thanks alot for your comment! I have tried other apps (not made by me) and they have the same problem. If you click the back button before the map is "done", they crash. So, I try to get it as stabile as possible and hope that this bug will be fixed in the next release.

By the way - only retain and not release as you wrote. Is that the same as create an object in xib file and then use this object over and over. I do not retain it at all in my code. Is that incorrect?

Thanks!
MACloop
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.