Need help in finding crash cause - iphone

Below are the crash logs from an iPad. I'm getting this crash randomly while I'm pushing and popping out a UIViewController from Navigation controller. Any help/pointer is appreciated.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x31430386 _ZL12realizeClassP7class_t + 34
1 libobjc.A.dylib 0x314303e6 _ZL12realizeClassP7class_t + 130
2 libobjc.A.dylib 0x3142a836 prepareForMethodLookup + 74
3 libobjc.A.dylib 0x3142a740 lookUpMethod + 40
4 libobjc.A.dylib 0x3142a70c _class_lookupMethodAndLoadCache3 + 12
5 libobjc.A.dylib 0x31429fc4 objc_msgSend_uncached + 20
6 UIKit 0x3186553e -[UINavigationItem _accumulateViewsFromItems:isLeft:refreshViews:] + 270
7 UIKit 0x31851244 -[UINavigationItem _updateViewsForBarSizeChangeAndApply:] + 124
8 UIKit 0x319e023a __33-[UINavigationBar layoutSubviews]_block_invoke_0 + 250
9 UIKit 0x31838b46 +[UIView(Animation) _performWithoutAnimation:] + 62
10 UIKit 0x3184d2e2 -[UINavigationBar layoutSubviews] + 382
11 UIKit 0x31814f30 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 176
12 CoreFoundation 0x315431f4 -[NSObject performSelector:withObject:] + 36
13 QuartzCore 0x35459a9e -[CALayer layoutSublayers] + 210
14 QuartzCore 0x354596b6 CA::Layer::layout_if_needed(CA::Transaction*) + 210
15 QuartzCore 0x3545d83c CA::Context::commit_transaction(CA::Transaction*) + 220
16 QuartzCore 0x3545d578 CA::Transaction::commit() + 308
17 QuartzCore 0x354554b2 CA:::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 50
18 CoreFoundation 0x315b8b14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
19 CoreFoundation 0x315b6d50 __CFRunLoopDoObservers + 252
20 CoreFoundation 0x315b70aa __CFRunLoopRun + 754
21 CoreFoundation 0x3153a49e CFRunLoopRunSpecific + 294
22 CoreFoundation 0x3153a366 CFRunLoopRunInMode + 98
23 GraphicsServices 0x32a13432 GSEventRunModal + 130
24 UIKit 0x3183fcce UIApplicationMain + 1074
25 SmartClassTPS 0x000b551a main (main.m:16)
26 SmartClassTPS 0x000b5170 start + 32

Was able to figure out long back but forgot to update here. KVO observer not removed! Silly me :-|. BTW thanks for the support. SO rocks.

Most probably you forgot to clear some delegates before releasing an object.

Related

ios core data NSFetchedResultsControllerDelegate crash

I am keep getting this error for NSFetchedResultsControllerDelegate.
not sure what to do with it, since it happen sporadically.
I do create the records synchronized, but still ..
any ideas why could this be?
- (Activity *)createActivityWithDictionary:(NSDictionary*)dict
{
#synchronized([DBController sharedManaged])
{
Activity *act = [Activity activityWithDictionary:dict inManagedObjectContext:self.managedObjectContext];
[self saveContext];
return act;
}
}
Date/Time: 2012-09-18 22:55:53.686 -0700
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3724188f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x34f46259 objc_exception_throw + 33
2 CoreFoundation 0x37244a9b -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x37243915 ___forwarding___ + 301
4 CoreFoundation 0x3719e650 _CF_forwarding_prep_0 + 48
5 CoreData 0x36a78f4d -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 2401
6 Foundation 0x37aa64ff __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 19
7 CoreFoundation 0x3720d547 ___CFXNotificationPost_block_invoke_0 + 71
8 CoreFoundation 0x37199097 _CFXNotificationPost + 1407
9 Foundation 0x37a1a3eb -[NSNotificationCenter postNotificationName:object:userInfo:] + 67
10 CoreData 0x36a00839 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 77
11 CoreData 0x36a0031d -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 305
12 CoreData 0x36a09d01 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 1245
13 CoreData 0x369fd145 -[NSManagedObjectContext save:] + 201
14 PalFinds 0x000a57cb -[DBController saveContext] (DBController.m:75)
15 PalFinds 0x000a8dff -[DBController createActivityWithDictionaries:] (DBController.m:852)
16 PalFinds 0x00086649 -[PFMe finishRequest:andRestConnection:] (PFMe.m:1986)
17 PalFinds 0x0002e17d -[RestConnection connectionDidFinishLoading:] (RestConnection.m:326)
18 Foundation 0x37addc29 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 17
19 Foundation 0x37a356d9 -[NSURLConnectionInternalConnection invokeForDelegate:] + 29
20 Foundation 0x37a356a3 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
21 Foundation 0x37a355c5 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 61
22 CFNetwork 0x36ed97f5 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 193
23 CFNetwork 0x36ece4a5 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 425
24 CFNetwork 0x36ece599 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 669
25 CFNetwork 0x36ece599 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 669
26 CFNetwork 0x36ece1a3 URLConnectionClient::processEvents() + 107
27 CFNetwork 0x36ece0d9 MultiplexerSource::perform() + 157
28 CoreFoundation 0x37215ad3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
29 CoreFoundation 0x3721529f __CFRunLoopDoSources0 + 215
30 CoreFoundation 0x37214045 __CFRunLoopRun + 653
31 CoreFoundation 0x371974a5 CFRunLoopRunSpecific + 301
32 CoreFoundation 0x3719736d CFRunLoopRunInMode + 105
33 GraphicsServices 0x33956439 GSEventRunModal + 137
34 UIKit 0x30f43cd5 UIApplicationMain + 1081
35 PalFinds 0x000038bf main (main.mm:14)
36 PalFinds 0x00003878 start + 40
Looks like it's trying to call the delegate back and the delegate isn't implementing a method it's supposed to.
I'm thinking either controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: or controllerDidChangeContent:
Did you implement those methods in your NSFetchedResultsControllerDelegate?
I know this might seem far fetched BUT I had a very similar problem and I had all those methods implemented and then I realized I had my release commented out for the fetchedREsultsController...once I put that back in no more sigbart and works like a charm.
All I'm saying is that sometimes the error isn't always the obvious.
We would need to see a bit more code to figure it out. Thanks.

iphone - understanding crash logs

Im developing my app and yesterday while I was playing with it crashed. I wasnt debugging, so I thought I'd take a look at the crash log today.
But my surprise is that I can't see anything that can give me some info, here it is:
Thread 0 Crashed:
0 libobjc.A.dylib 0x33479464 objc_msgSend + 16
1 MapKit 0x31bffe28 -[MKMapView annotationContainer:viewForAnnotation:] + 36
2 MapKit 0x31bffaba -[MKAnnotationContainerView _addViewForAnnotation:] + 270
3 MapKit 0x31c25540 -[MKAnnotationContainerView addViewForManagedAnnotation:] + 8
4 MapKit 0x31c21df2 -[MKMapView(UserPositioningInternal) _runPositioningChange] + 1034
5 MapKit 0x31c20036 -[MKMapView(UserPositioningInternal) _startPositioningChange:] + 22
6 MapKit 0x31c23446 -[MKMapView(UserPositioningInternal) locationManagerUpdatedLocation:] + 578
7 CoreFoundation 0x33a5ebb8 -[NSObject(NSObject) performSelector:withObject:] + 16
8 CoreFoundation 0x33a83266 -[NSArray makeObjectsPerformSelector:withObject:] + 394
9 MapKit 0x31c1232a -[MKLocationManager _reportLocationStatus:] + 34
10 MapKit 0x31c13844 -[MKLocationManager _reportLocationSuccess] + 36
11 MapKit 0x31c134b8 -[MKLocationManager locationManager:didUpdateToLocation:fromLocation:] + 688
12 CoreLocation 0x34371410 -[CLLocationManager onClientEventLocation:] + 528
13 CoreLocation 0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98
14 CoreLocation 0x3436f7e6 OnClientEventInternal + 14
15 CoreLocation 0x3436b534 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 60
16 CoreLocation 0x3436d3cc CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 196
17 CoreLocation 0x3436d512 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 286
18 CoreFoundation 0x33a813fe __CFMessagePortPerform + 242
19 CoreFoundation 0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
20 CoreFoundation 0x33a556bc __CFRunLoopDoSource1 + 160
21 CoreFoundation 0x33a47f76 __CFRunLoopRun + 514
22 CoreFoundation 0x33a47c80 CFRunLoopRunSpecific + 224
23 CoreFoundation 0x33a47b88 CFRunLoopRunInMode + 52
24 GraphicsServices 0x33b0e4a4 GSEventRunModal + 108
25 GraphicsServices 0x33b0e550 GSEventRun + 56
26 UIKit 0x32099322 -[UIApplication _run] + 406
27 UIKit 0x32096e8c UIApplicationMain + 664
28 Palyque 0x0000280a main (main.m:14)
29 Palyque 0x00002794 start + 44
Hope you can help me with this, thanks.
Without the app still in memory I'm not sure there's much you can do. From experience I guess you messaged an object that has been dealloc'd. (Maybe the datasource object for your MKMapView?) I'd try running your app with zombies enabled to track it down.

how to interpret this crash log of iphone

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x00004420 objc_msgSend + 24
1 CoreFoundation 0x000042a6 CFRetain + 54
2 CoreFoundation 0x0000a9f0 __CFBasicHashStandardRetainValue + 8
3 CoreFoundation 0x000054c0 __CFBasicHashAddValue + 100
4 CoreFoundation 0x00006184 CFBasicHashAddValue + 276
5 CoreFoundation 0x00006cfe CFDictionaryCreate + 58
6 CoreFoundation 0x00033d7c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 1456
7 CoreFoundation 0x000361bc -[NSDictionary initWithObjectsAndKeys:] + 776
8 iota 0x0000cb04 -[CorpDirViewController reloadDisplayList] (CorpDirViewController.m:833)
9 iota 0x000098ba -[CorpDirViewController refreshDataAndDisplay] (CorpDirViewController.m:134)
10 iota 0x00009b62 -[CorpDirViewController handleNotication:] (CorpDirViewController.m:197)
11 Foundation 0x00015432 _nsnote_callback + 150
12 CoreFoundation 0x000271da __CFXNotificationPost_old + 390
13 CoreFoundation 0x00026e7a _CFXNotificationPostNotification + 122
14 Foundation 0x0000b9f6 -[NSNotificationCenter postNotification:] + 138
15 Foundation 0x0007ae02 postQueueNotifications + 258
16 Foundation 0x0007afae __NSPostIdleQueueNotes + 6
17 CoreFoundation 0x00031084 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
18 CoreFoundation 0x00030eb2 __CFRunLoopDoObservers + 494
19 CoreFoundation 0x00028206 __CFRunLoopRun + 934
20 CoreFoundation 0x00027d74 CFRunLoopRunSpecific + 220
21 CoreFoundation 0x00027c82 CFRunLoopRunInMode + 54
22 GraphicsServices 0x00004e84 GSEventRunModal + 188
23 UIKit 0x00004f8c -[UIApplication _run] + 564
24 UIKit 0x000024cc UIApplicationMain + 964
25 iota 0x00005582 main (main.m:17)
26 iota 0x00005544 0x1000 + 17732
From the looks of the log, you have overreleased something and that is causing a crash. Take a look at this line in your code:
8 iota 0x0000cb04 -[CorpDirViewController reloadDisplayList] (CorpDirViewController.m:833)
Which has the file and the line of code affected:
[CorpDirViewController reloadDisplayList] (CorpDirViewController.m:833)

Enumeration Mutation During UIView transitionWithView

I'm experience an occasional crash of my iPhone application where I'm getting the following exception
NSGenericException', reason: '*** Collection <CALayerArray: 0x26f6b0> was mutated while being enumerated.
With the stack trace on the crashing thread of
Thread 0 Crashed:
0 libSystem.B.dylib 0x00078ac8 __kill + 8
1 libSystem.B.dylib 0x00078ab8 kill + 4
2 libSystem.B.dylib 0x00078aaa raise + 10
3 libSystem.B.dylib 0x0008d03a abort + 50
4 libstdc++.6.dylib 0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x00005958 _objc_terminate + 104
6 libstdc++.6.dylib 0x00042df2 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x00042e46 std::terminate() + 10
8 libstdc++.6.dylib 0x00042f16 __cxa_throw + 78
9 libobjc.A.dylib 0x00004838 objc_exception_throw + 64
10 CoreFoundation 0x0009f850 __NSFastEnumerationMutationHandler + 208
11 libobjc.A.dylib 0x0000a51a objc_enumerationMutation + 18
12 UIKit 0x00007bfe -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 142
13 UIKit 0x00007c2e -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
14 UIKit 0x00007cd2 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:] + 22
15 UIKit 0x00007628 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 304
16 UIKit 0x000074e8 -[UIView(Hierarchy) addSubview:] + 16
17 UIKit 0x0006c350 +[UIViewControllerWrapperView wrapperViewForView:frame:] + 232
18 UIKit 0x00077d0c -[UINavigationController _startTransition:fromViewController:toViewController:] + 468
19 UIKit 0x00077abc -[UINavigationController _startDeferredTransitionIfNeeded] + 176
20 UIKit 0x00077a00 -[UINavigationController viewWillLayoutSubviews] + 8
21 UIKit 0x0006dca8 -[UILayoutContainerView layoutSubviews] + 132
22 UIKit 0x0000fbc0 -[UIView(CALayerDelegate) _layoutSublayersOfLayer:] + 20
23 CoreFoundation 0x0003e2e4 -[NSObject(NSObject) performSelector:withObject:] + 16
24 QuartzCore 0x0000f942 -[CALayer layoutSublayers] + 114
25 QuartzCore 0x0000f6fa CALayerLayoutIfNeeded + 178
26 QuartzCore 0x000094c4 CA::Context::commit_transaction(CA::Transaction*) + 204
27 QuartzCore 0x000092da CA::Transaction::commit() + 186
28 QuartzCore 0x0002d9b6 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 46
29 CoreFoundation 0x00030236 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10
30 CoreFoundation 0x000300aa __CFRunLoopDoObservers + 406
31 CoreFoundation 0x000276b4 __CFRunLoopRun + 848
32 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
33 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
34 GraphicsServices 0x000045ec GSEventRunModal + 108
35 GraphicsServices 0x00004698 GSEventRun + 56
36 UIKit 0x0000411c -[UIApplication _run] + 396
37 UIKit 0x00002128 UIApplicationMain + 664
38 iDriveGreen 0x00003026 main (main.m:13)
39 iDriveGreen 0x00002ff0 start + 32
This crash is being triggered after the following code is executed.
StopRouteViewController *stopVC = [[StopRouteViewController alloc] init];
[UIView transitionWithView:self.navigationController.view
duration:0.5
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[self.navigationController pushViewController:stopVC animated:NO];
}
completion:NULL];
[stopVC release];
Does this look blatantly wrong to anyone? My current thought is that is is either tied to stopVC being released before it is pushed or with transitioning with navigationController.view while at the same time pushing a new viewController to the navigationController.
Since this only occurs occasionally, I'd like to have a little more confidence before I commit a potential fix.
Yes, this is incorrect usage of the API. -[UINavigationController pushViewController:animated:] handles animation on its own. Even if you pass NO as the second argument, it is still manipulating the view hierarchy, which is what's causing your crash.
Basically, there is no reason to put a call to -[UINavigationController pushViewController:animated:] in an animation block, as you have done. If you want to animate the push of your controller, pass YES as the second argument.

Application Crashing due to EXC_BAD_ACCESS

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x00004420 objc_msgSend + 24
1 CoreFoundation 0x000042a6 CFRetain + 54
2 CoreFoundation 0x0000a9f0 __CFBasicHashStandardRetainValue + 8
3 CoreFoundation 0x000054c0 __CFBasicHashAddValue + 100
4 CoreFoundation 0x00006184 CFBasicHashAddValue + 276
5 CoreFoundation 0x00006cfe CFDictionaryCreate + 58
6 CoreFoundation 0x00033d7c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 1456
7 CoreFoundation 0x000361bc -[NSDictionary initWithObjectsAndKeys:] + 776
8 iota 0x0000c4cc 0x1000 + 46284
9 iota 0x00009282 0x1000 + 33410
10 iota 0x0000952a 0x1000 + 34090
11 Foundation 0x00015432 _nsnote_callback + 150
12 CoreFoundation 0x000271da __CFXNotificationPost_old + 390
13 CoreFoundation 0x00026e7a _CFXNotificationPostNotification + 122
14 Foundation 0x0000b9f6 -[NSNotificationCenter postNotification:] + 138
15 Foundation 0x0007ae02 postQueueNotifications + 258
16 Foundation 0x0007afae __NSPostIdleQueueNotes + 6
17 CoreFoundation 0x00031084 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
18 CoreFoundation 0x00030eb2 __CFRunLoopDoObservers + 494
19 CoreFoundation 0x00028206 __CFRunLoopRun + 934
20 CoreFoundation 0x00027d74 CFRunLoopRunSpecific + 220
21 CoreFoundation 0x00027c82 CFRunLoopRunInMode + 54
22 GraphicsServices 0x00004e84 GSEventRunModal + 188
23 UIKit 0x00004f8c -[UIApplication _run] + 564
24 UIKit 0x000024cc UIApplicationMain + 964
25 iota 0x0000533a 0x1000 + 17210
26 iota 0x000052fc 0x1000 + 17148
NSDictionary *contactNameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:item, #"contact", sortName, #"contactSortName", compositeName, #"compositeName", nil];
The crashes are random. Like it happens once in 15 trials of a particular action.
KERN_PROTECTION_FAILURE - means that your program is accessing a shared memory that it didn't have access to. That's why kenel sent killed your process. I'm pretty sure that some of your pointers point to wrong location. E.g.
NSObject* obj;
obj would have garbage as it's value. You have to declare it like this:
NSObject* obj = nil;
Without more info, it's hard to say. Usually it's because you try to access/insert into your dictionary an object that doesn't exist anymore.
Check if you're not inserting something that is not an instance of NSObject, like an int or something.
Given that you are using initWithObjectsAndKeys:, make sure that you have nil-terminated the list of arguments, as that's a common mistake that can lead to crashes.