I am working on an iPhone application which is crashing after the routine tied to a button call is completed. I am popping the view which is at position index 1 on the navigation controller stack. The current view on which i clicked the button is on index 5.
The code I use for popping the view is as follows:
id callListController = [[self.navigationController viewControllers] objectAtIndex:1];
if(nil != callListController)
{
[self.navigationController popToViewController:callListController animated:YES];
}
I have tried setting break points in the above code and also in the code of the view to be loaded at index 1. Nothing works. Something is happening in between.
I used the crash report from the iphone (symbolicated) to analyze the issue. Honestly, I cannot make sense of symbolicated file. Here is the dump of main portion of the file since I could not attach with this questionnaire:
Incident Identifier: BDE0FFE7-D74F-46B5-A9BD-89AA4F483300
CrashReporter Key: fbe272c09f9d46b3e962f897e0d8a5e3de9793e1
Hardware Model: iPhone1,2
Process: iwf [151]
Path: /var/mobile/Applications/F50D0AED-94A4-48A8-8B5D-0D88B2D4D36F/iwf.app/iwf
Identifier: iwf
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-02-22 20:43:10.614 -0700
OS Version: iPhone OS 4.0.1 (8A306)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x00088c24 __kill + 8
1 libSystem.B.dylib 0x00088c12 kill + 4
2 libSystem.B.dylib 0x00088c06 raise + 10
3 libSystem.B.dylib 0x0009f902 abort + 54
4 libSystem.B.dylib 0x0008e6de szone_error + 230
5 libSystem.B.dylib 0x0008e7ac free_tiny_botch + 60
6 libSystem.B.dylib 0x00001fe8 szone_free + 302
7 libSystem.B.dylib 0x00001ea0 malloc_zone_free + 64
8 CoreFoundation 0x00053cc8 __CFAllocatorSystemDeallocate + 8
9 CoreFoundation 0x000019d6 CFAllocatorDeallocate + 74
10 CoreFoundation 0x000036c4 _CFRelease + 288
11 CoreFoundation 0x00003566 CFRelease + 74
12 CoreFoundation 0x00015898 _CFAutoreleasePoolPop + 124
13 Foundation 0x00004822 -[NSAutoreleasePool release] + 98
14 UIKit 0x0007bc18 _UIApplicationHandleEvent + 7776
15 GraphicsServices 0x00004edc PurpleEventCallback + 1024
16 CoreFoundation 0x000742ac __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 22
17 CoreFoundation 0x000761d6 __CFRunLoopDoSource1 + 158
18 CoreFoundation 0x0007718e __CFRunLoopRun + 574
19 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
20 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
21 GraphicsServices 0x00003f88 GSEventRunModal + 188
22 UIKit 0x00007b40 -[UIApplication _run] + 564
23 UIKit 0x00005fb8 UIApplicationMain + 964
24 iwf 0x0000d434 main (main.m:14)
25 iwf 0x0000d404 start + 32
Thread 1:
0 libSystem.B.dylib 0x00034e84 kevent + 24
1 libSystem.B.dylib 0x00102a48 _dispatch_mgr_invoke + 88
2 libSystem.B.dylib 0x00102494 _dispatch_queue_invoke + 96
3 libSystem.B.dylib 0x00102634 _dispatch_worker_thread2 + 120
4 libSystem.B.dylib 0x0008b53c _pthread_wqthread + 392
5 libSystem.B.dylib 0x00082b6c start_wqthread + 0
Thread 2:
0 libSystem.B.dylib 0x00000ab0 mach_msg_trap + 20
1 libSystem.B.dylib 0x00002f94 mach_msg + 60
2 CoreFoundation 0x00074b18 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x000770e0 __CFRunLoopRun + 400
4 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
5 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
6 WebCore 0x0000370c RunWebThread(void*) + 552
7 libSystem.B.dylib 0x0008af80 _pthread_start + 364
8 libSystem.B.dylib 0x0007d014 thread_start + 0
Thread 3:
0 libSystem.B.dylib 0x00000ab0 mach_msg_trap + 20
1 libSystem.B.dylib 0x00002f94 mach_msg + 60
2 CoreFoundation 0x00074b18 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x000770e0 __CFRunLoopRun + 400
4 CoreFoundation 0x0001e0bc CFRunLoopRunSpecific + 220
5 CoreFoundation 0x0001dfca CFRunLoopRunInMode + 54
6 Foundation 0x0003c316 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 210
7 Foundation 0x0000c612 -[NSThread main] + 42
8 Foundation 0x00092140 __NSThread__main__ + 908
9 libSystem.B.dylib 0x0008af80 _pthread_start + 364
10 libSystem.B.dylib 0x0007d014 thread_start + 0
Thread 4:
0 libSystem.B.dylib 0x00029f24 select$DARWIN_EXTSN + 20
1 CoreFoundation 0x0007aa54 __CFSocketManager + 340
2 libSystem.B.dylib 0x0008af80 _pthread_start + 364
3 libSystem.B.dylib 0x0007d014 thread_start + 0
Thread 5:
0 libSystem.B.dylib 0x0008c3b4 __workq_kernreturn + 8
1 libSystem.B.dylib 0x0008b718 _pthread_wqthread + 868
2 libSystem.B.dylib 0x00082b6c start_wqthread + 0
Thread 6:
0 libSystem.B.dylib 0x0008c3b4 __workq_kernreturn + 8
1 libSystem.B.dylib 0x0008b718 _pthread_wqthread + 868
2 libSystem.B.dylib 0x00082b6c start_wqthread + 0
Thread 0 crashed with ARM Thread State:
r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x3e73926c
r4: 0x00000006 r5: 0x067a9e50 r6: 0x0013f000 r7: 0x2fffe464
r8: 0x05559084 r9: 0x00000888 r10: 0x00000001 r11: 0x0013f000
ip: 0x00000025 sp: 0x2fffe464 lr: 0x3483fc19 pc: 0x3483fc24
cpsr: 0x000f0010
I have a basic understanding that this error is happening when I shift views but I am little lost at this point.
Any advice will be helpful.
Thanks in advance.
Subbu
As Izzy said, this is usually caused by releasing an autorelease object, a pretty common problem until you get a handle on memory management in Objective-C.
If you are not sure specifically where to look for the problem, you might want to start by commenting out all of the releases in viewWillDisappear/dealloc in your views, and assuming it works without crashing, start to put back in the releases until you narrow down an ivar that is causing a problem. Most likely, you will find that the ivar is given an object that is an autorelease object, so you will either not release the object, retain the object, or use a method that gives you back a retained object.
Check this link for more background:
It's crashing because you're over releasing in one of your view controllers.
P.S. You should check viewControllers
length before asking for object with index 1. It can lead to crash if viewControllers
array contains less than 2 objects.
User contributions licensed under CC BY-SA 3.0