UICollectionViewData updateItemCounts Crash - ios

I'm getting crashes from deep inside Apple's layout code for a UICollectionViewFlowLayout and I have no idea how to address these (stack trace below). Any suggestions would be greatly appreciated.
Details:
Unfortunately I can't reproduce the issue
The issue isn't frequent (it happens in less than 0.1% of sessions) but it's our #1 crash
#0. Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x1879490d4 __bzero + 36
1 UIKit 0x18e824e40 -[UICollectionViewData _updateItemCounts] + 544
2 UIKit 0x18e824e40 -[UICollectionViewData _updateItemCounts] + 544
3 UIKit 0x18e8e67e0 -[UICollectionViewData numberOfSections] + 28
4 UIKit 0x18f086bc0 -[UICollectionViewFlowLayout _getSizingInfosWithExistingSizingDictionary:] + 612
5 UIKit 0x18f088834 -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 152
6 UIKit 0x18e8e66b4 -[UICollectionViewFlowLayout prepareLayout] + 224
7 UIKit 0x18e7cf574 -[UICollectionViewData _prepareToLoadData] + 164
8 UIKit 0x18e7ceb5c -[UICollectionViewData validateLayoutInRect:] + 100
9 UIKit 0x18e7ce55c -[UICollectionView layoutSubviews] + 212
10 UIKit 0x18e76fa80 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1196
11 QuartzCore 0x18bc1d9d8 -[CALayer layoutSublayers] + 148
12 QuartzCore 0x18bc124cc CA::Layer::layout_if_needed(CA::Transaction*) + 292
13 QuartzCore 0x18bc1238c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
14 QuartzCore 0x18bb8f3e0 CA::Context::commit_transaction(CA::Transaction*) + 252
15 QuartzCore 0x18bbb6a68 CA::Transaction::commit() + 512
16 QuartzCore 0x18bbb7488 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
17 CoreFoundation 0x18886a0c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
18 CoreFoundation 0x188867cf0 __CFRunLoopDoObservers + 372
19 CoreFoundation 0x188868180 __CFRunLoopRun + 1024
20 CoreFoundation 0x1887962b8 CFRunLoopRunSpecific + 444
21 GraphicsServices 0x18a24a198 GSEventRunModal + 180
22 UIKit 0x18e7dd7fc -[UIApplication _run] + 684
23 UIKit 0x18e7d8534 UIApplicationMain + 208
24 AppName Mobile 0x1000333e8 main (main.m:16)
25 libdispatch.dylib 0x1877795b8 (Missing)

We finally found this one. It wasn't the performBatchUpdates issue reported on a lot of other cards. The root cause was one our data sources would return a negative number for item count. The SDK is using an unsigned int, so setting a negative rolled over, and would try to allocate billions of cells (34 GB of virtual memory and counting). It would eventually crash.

There is a rampant problem with item counts and performBatchUpdates. Specifically, you may run into discrepancies and an OS assert if these are not in sync. An assert is not a crash.
I do suspect that this is what you encountered here, and if so, this question may be a duplicate of:
Nightmare with performBatchUpdates crash
How to solve this CollectionView crash
UICollectionView performBatchUpdates crash
crashing at performBatchUpdates of collection view
Assert or not, a defensive approach is to guard the item count as excellently outlined in Fang-Pen Lin's(†) UICollectionView invalid number of items crash problem and solution blog post:
func updateItems(updates: [ItemUpdate]) {
collectionView.performBatchUpdates({
for update in updates {
switch update {
case .Add(let index):
collectionView.insertItemsAtIndexPaths([NSIndexPath(forItem: index, inSection: 0)])
itemCount += 1
case .Delete(let index):
collectionView.deleteItemsAtIndexPaths([NSIndexPath(forItem: index, inSection: 0)])
itemCount -= 1
}
}
}, completion: nil)
}
† Full Credit

Related

EXC_BREAKPOINT due to a wrong conversion

While checking the issues reported by Crashlytics, it seems that I have a EXC_BREAKPOINT error for the following line:
self.caloriesFor100 = Int((cartFood.nbCalories.floatValue / 100) * cartFood.quantite.floatValue)
caloriesFor100 is a Int.
cartFood.nbCalories is an NSNumber which is supposed to have float values.
cartFood.quantite is also an NSNumber which is supposed to have float values.
I did not succeed to reproduce the issue. What could possibly cause an EXC_BREAKPOINT in this code?
Full stack trace:
Crashed: com.apple.main-thread
0 LSDP 0x10269ccbc specialized CartFoodModelinit(_:) (CartFoodModel.swift:88)
1 LSDP 0x10268a570 specialized CartFoodCell.cartFoodObjc (CartFoodModel.swift)
2 LSDP 0x102689600 #objc CartFoodCell.cartFoodObjc (<compiler-generated>)
3 LSDP 0x102664c7c -[PanierDuJourViewController tableView:cellForRowAtIndexPath:] (PanierDuJourViewController.m:156)
4 UIKit 0x18bf10148 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
5 UIKit 0x18bf0fe00 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
6 UIKit 0x18bf0eb1c -[UITableView _updateVisibleCellsNow:isRecursive:] + 2280
7 UIKit 0x18bf0a668 -[UITableView layoutSubviews] + 140
8 UIKit 0x18be47770 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420
9 QuartzCore 0x1863e925c -[CALayer layoutSublayers] + 184
10 QuartzCore 0x1863ed3ec CA::Layer::layout_if_needed(CA::Transaction*) + 324
11 QuartzCore 0x186359aa0 CA::Context::commit_transaction(CA::Transaction*) + 320
12 QuartzCore 0x1863815d0 CA::Transaction::commit() + 580
13 UIKit 0x18c22054c _UIApplicationFlushRunLoopCATransactionIfTooLate + 172
14 UIKit 0x18c7fd4c0 __handleEventQueueInternal + 5520
15 UIKit 0x18c7f6258 __handleHIDEventFetcherDrain + 152
16 CoreFoundation 0x18221b404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
17 CoreFoundation 0x18221ac2c __CFRunLoopDoSources0 + 276
18 CoreFoundation 0x18221879c __CFRunLoopRun + 1204
19 CoreFoundation 0x182138da8 CFRunLoopRunSpecific + 552
20 GraphicsServices 0x18411b020 GSEventRunModal + 100
21 UIKit 0x18c11978c UIApplicationMain + 236
22 LSDP 0x1025fce28 main (main.m:16)
23 libdyld.dylib 0x181bc9fc0 start + 4
You may catch this exception in case if NSNumber property will be nil. So maybe it is better to change nbCalories to has an option value.
I found a similar problem and its solution here.
Since your app crashes at tableView:cellForRowAtIndexPath:, it might be that the cell should display an entry of your table (CartFoodCell.cartFoodObjc) that no longer exists.
But without more code, this is just a guess. Please double check it in your code.

iOS: Understanding SIGABRT crash from Crashlytics

So I am receiving Crashlytics crash report for my iOS App. For some of the users the app has been crashing giving SIGABRT in the crash log.
I have been trying to find the cause of this error for countless hours but due to rarity of the error (around 1-2% users) I have been unable to reproduce the error and, due to limited amount of information from Crashlytics, I have been unable to find the root cause of this error.
The deployment target is iOS 7 for the app and devices of all sizes with iOS 10+ are experiencing the crash (I am not sure if iOS 9, 8 or 7 are also experiencing the error — Crashlytics is only showing crashes on iOS 10+)
Here is the stack trace:
CRASH_INFO_ENTRY_1
*** error for object 0x17127f4c0: Invalid pointer dequeued from free list
CRASH_INFO_ENTRY_0
abort() called
Crashed: com.apple.main-thread
SIGABRT ABORT 0x000000018e2ea014
#0. Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x18f6ca014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x18f791460 pthread_kill + 112
2 libsystem_c.dylib 0x18f63e3f4 abort + 140
3 libsystem_malloc.dylib 0x18f70ea38
_nano_vet_and_size_of_live + 330
4 libsystem_malloc.dylib 0x18f710bf0
_nano_malloc_check_clear + 392
5 libsystem_malloc.dylib 0x18f70fbb4 nano_calloc + 80
6 libsystem_malloc.dylib 0x18f701180 malloc_zone_calloc + 152
7 libsystem_malloc.dylib 0x18f7010c4 calloc + 40
8 libobjc.A.dylib 0x18f131cfc cache_t::reallocate(unsigned int, unsigned int) + 52
9 libobjc.A.dylib 0x18f1321fc cache_fill + 216
10 libobjc.A.dylib 0x18f13cd00 lookUpImpOrForward + 412
11 libobjc.A.dylib 0x18f147258 _objc_msgSend_uncached + 56
12 UIKit 0x1967274e8 -[UITableView _endCellAnimationsWithContext:] + 13964
13 Champion 0x100097bf4 -[MatchdayComposeController controllerDidChangeContent:] (MatchdayComposeController.m:427)
14 CoreData 0x192abfe28 __82-[NSFetchedResultsController(PrivateMethods) _core_managedObjectContextDidChange:]_block_invoke + 4760
15 CoreData 0x192abeb80 -[NSFetchedResultsController(PrivateMethods) _core_managedObjectContextDidChange:] + 124
16 CoreFoundation 0x19069622c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
17 CoreFoundation 0x190695930 _CFXRegistrationPost + 400
18 CoreFoundation 0x1906956ac ___CFXNotificationPost_block_invoke + 60
19 CoreFoundation 0x190704b9c -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1504
20 CoreFoundation 0x1905d7bf4 _CFXNotificationPost + 376
21 Foundation 0x1910de6bc -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
22 CoreData 0x1929eed1c -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 724
23 CoreData 0x192a75170 -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:deletions:updates:refreshes:deferrals:wasMerge:] + 1336
24 CoreData 0x1929ed338 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2116
25 CoreData 0x1929ebe3c -[NSManagedObjectContext save:] + 416
26 Champion 0x10008e2ac -[AppDelegate saveContext] (AppDelegate.m:263)
27 Champion 0x10009d1d4 +[Globals saveManagedObjectContext] (Globals.m:157)
28 Champion 0x10006ee4c -[EntitySyncClient saveUpdates:] (EntitySyncClient.m:232)
29 Champion 0x1000690a0 -[MatchController datepickerDidChangeValue:] (MatchController.m:994)
30 UIKit 0x1965799a0 -[UIApplication sendAction:to:from:forEvent:] + 96
31 UIKit 0x196579920 -[UIControl sendAction:to:forEvent:] + 80
32 UIKit 0x196563dd0 -[UIControl _sendActionsForEvents:withEvent:] + 452
33 UIKit 0x196e62c44 -[_UIDatePickerView pickerView:didSelectRow:inComponent:] + 540
34 UIKit 0x1967b965c -[UIPickerView _sendSelectionChangedForComponent:notify:] + 116
35 UIKit 0x1967b9894 -[UIPickerView _sendSelectionChangedFromTable:notify:] + 344
36 UIKit 0x196ce6878 -[UIPickerTableView _scrollingFinished] + 188
37 UIKit 0x196ce6a50 -[UIPickerTableView scrollViewDidEndDecelerating:] + 28
38 UIKit 0x196857abc -[UIScrollView(UIScrollViewInternal) _scrollViewDidEndDeceleratingForDelegate] + 132
39 UIKit 0x1966ed2cc -[UIScrollView(UIScrollViewInternal) _stopScrollDecelerationNotify:] + 332
40 UIKit 0x1966ece08 -[UIScrollView _smoothScrollWithUpdateTime:] + 2356
41 QuartzCore 0x1938ff640 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44
42 QuartzCore 0x1938ff4ec CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 444
43 IOKit 0x190968570 IODispatchCalloutFromCFMessage + 372
44 CoreFoundation 0x19069256c __CFMachPortPerform + 180
45 CoreFoundation 0x1906aa934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
46 CoreFoundation 0x1906aa0e8 __CFRunLoopDoSource1 + 436
47 CoreFoundation 0x1906a7bcc __CFRunLoopRun + 1840
48 CoreFoundation 0x1905d6048 CFRunLoopRunSpecific + 444
49 GraphicsServices 0x192059198 GSEventRunModal + 180
50 UIKit 0x1965af818 -[UIApplication _run] + 684
51 UIKit 0x1965aa550 UIApplicationMain + 208
52 Champion 0x1000b082c main (main.m:14)
53 libdispatch.dylib 0x18f5b85b8 (Missing)
I would be extremely grateful for any kind of assistance. I would also be grateful if I can get any kind of pointers for reproducing Crashlytics errors.
Updating the Question with Code
In the controllerDidChangeContent: mainly the table view is ending updates.
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self.tableView endUpdates];
if(controller.fetchedObjects.count == 0){
self.showsNoMatchesHint = YES;
}
else{
self.showsNoMatchesHint = NO;
}
}
Given the last gasp of your program was in _endCellAnimationsWithContext, and these types of animations usually occur on completion of cell editing, I'd look into problems when that particular table is completing a cell edit operation. There's a picker view and a notification also going on in there, so that should narrow it down some. Good luck.
It looks like caused by this line of code
[self.tableView endUpdates];
I would suggest you to make sure the logic of -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView is correct. For example, it doesn't return 0 while the array is empty. Good luck.

EXC_BAD_ACCESS error with iOS8 ABMembersViewController

Since iOS8 went live the other day, I've started to get lots of crash reports to do with address book / contact functionality. It's one of those annoying ones where the stack trace gives no clues about where in my code the problem originates. I've tried reproducing this in the iOS8 simulator by using the most obviously related functionality, but so far without joy (I don't own any devices running iOS8 yet).
The actual error is: Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000010
Here's the stack trace:
0 libobjc.A.dylib objc_msgSend + 16 respondsToSelector:
1 AddressBookUI -[ABMembersViewController membersController:shouldAllowSelectingPersonWithRecordID:] + 100
2 AddressBookUI -[ABMembersFilteredDataSource tableView:cellForRowAtIndexPath:] + 488
3 UIKit -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 544
4 UIKit -[UITableView _updateVisibleCellsNow:isRecursive:] + 2360
5 UIKit -[UITableView layoutSubviews] + 172
6 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572
7 QuartzCore -[CALayer layoutSublayers] + 168
8 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 320
9 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
10 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 276
11 QuartzCore CA::Transaction::commit() + 436
12 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
18 UIKit UIApplicationMain + 1488
19 Prayer Partner main.m line 14 main
20 libdyld.dylib start + 4
I thought I'd post it here in case anybody has had any similar errors.

iOS - Determining the cause of a crash (from a crash report) in _WebTryThreadLock

I have been trying to figure out what is causing one of the top crashes in my iOS application. It looks like there is some layout happening on a background thread which is causing it to crash. Is there any way to determine what I might be doing that is triggering this relayout? I assume from the stack that it is related to a UIWebView when my app is being brought back into the foreground.
Other stackoverflow threads on the topic seem to mention things like triggering a table reload on a background thread. As far as I can see all the webView delegate methods get called on the main thread. Is there some case where this is not true or are there some other methods which get called on a background thread and I'm just not aware?
Web Thread - Crashed.
0 WebCore _WebTryThreadLock(bool) + 297
1 WebCore _WebTryThreadLock(bool) + 288
2 WebCore WebThreadLock + 66
3 UIKit -[UIWebDocumentView(UIWebDocumentViewTextSelecting) selectionBaseWritingDirection] + 10
4 UIKit -[UITextField _currentTextAlignment] + 86
5 UIKit -[UITextField _showsClearButtonWhenNonEmpty:] + 58
6 UIKit -[UITextField _textRectForBounds:forEditing:] + 678
7 UIKit -[UITextField editingRectForBounds:] + 52
8 UIKit -[UITextField editRect] + 70
9 UIKit -[UITextField layoutSubviews] + 1320
10 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
11 QuartzCore -[CALayer layoutSublayers] + 214
12 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 460
13 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
14 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 238
15 QuartzCore CA::Transaction::commit() + 316
16 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 60
17 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
18 CoreFoundation __CFRunLoopDoObservers + 276
19 CoreFoundation CFRunLoopRunSpecific + 394
20 CoreFoundation CFRunLoopRunInMode + 104
21 WebCore RunWebThread(void*) + 444
22 libsystem_c.dylib pthread_start + 308
Main - Thread
0 libsystem_kernel.dylib __psynch_mutexwait + 24
1 libsystem_c.dylib pthread_mutex_lock + 392
2 WebCore _WebTryThreadLock(bool) + 336
3 WebCore WebThreadLock + 66
4 WebKit -[WebDatabasePauser applicationWillEnterForeground] + 16
5 CoreFoundation _CFXNotificationPost + 1426
6 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
7 UIKit -[UIApplication _sendWillEnterForegroundCallbacks] + 154
8 UIKit -[UIApplication _handleApplicationResumeEvent:] + 1094
9 UIKit -[UIApplication handleEvent:withNewEvent:] + 1292
10 UIKit -[UIApplication sendEvent:] + 72
11 UIKit _UIApplicationHandleEvent + 6154
12 GraphicsServices _PurpleEventCallback + 590
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
14 CoreFoundation __CFRunLoopDoSources0 + 212
15 CoreFoundation __CFRunLoopRun + 646
16 CoreFoundation CFRunLoopRunSpecific + 356
17 CoreFoundation CFRunLoopRunInMode + 104
18 GraphicsServices GSEventRunModal + 74
19 UIKit UIApplicationMain + 1120
20 AppName main.m line 23
It seems you are updating UI on the background thread, in your code add this line wherever you are updating your UI and you are fetching data on the background thread:
dispatch_async(dispatch_get_main_queue(), ^{
// Update data here
});
As soon as you, rather code feels that data is there on device and it's time to update the UI corresponding to new data then try and bring back main thread in action.
Hope it helps.

i fail to understand these 2 crash reports

Since i received comments of crashes but the app never crashes for me, I now use critterism to hunt down crashes.
I received one report that pointed to me to an error by me. It was easy, since the method name was given and i
could look in my code what might crash. So far, so good.
But i also have the following two that puzzle me.
To me it looks like the app crashes in some internal apple library.( Most likely due to me feeding it some broken stuff...)
There is no call from my code in the crash, so where do start looking?
Does anyone understand these crashes?
Any idea how i can catch these and maybe get some more crash info?
No.1:
0 CoreFoundation 0x3585f88f __exceptionPreprocess + 162
1 libobjc.A.dylib 0x37c06259 objc_exception_throw + 32
2 CoreFoundation 0x35862a9b -[NSObject doesNotRecognizeSelector:] + 174
3 CoreFoundation 0x35861915 ___forwarding___ + 300
4 CoreFoundation 0x357bc650 _CF_forwarding_prep_0 + 48
5 UIKit 0x332f3efb -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 546
6 UIKit 0x332f2f39 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 916
7 UIKit 0x332f2763 -[UITableView layoutSubviews] + 206
8 UIKit 0x33296f37 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 182
9 CoreFoundation 0x357be1fb -[NSObject performSelector:withObject:] + 42
10 QuartzCore 0x3268eaa5 -[CALayer layoutSublayers] + 216
11 QuartzCore 0x3268e6bd _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 216
12 QuartzCore 0x32692843 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 226
13 QuartzCore 0x3269257f _ZN2CA11Transaction6commitEv + 314
14 QuartzCore 0x326ba911 _ZN2CA11Transaction5flushEv + 44
15 QuartzCore 0x326ba8e3 +[CATransaction flush] + 34
16 UIKit 0x332a1fb1 _afterCACommitHandler + 52
17 CoreFoundation 0x35833b1b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
18 CoreFoundation 0x35831d57 __CFRunLoopDoObservers + 258
19 CoreFoundation 0x358320b1 __CFRunLoopRun + 760
20 CoreFoundation 0x357b54a5 CFRunLoopRunSpecific + 300
21 CoreFoundation 0x357b536d CFRunLoopRunInMode + 104
22 GraphicsServices 0x37451439 GSEventRunModal + 136
23 UIKit 0x332c1cd5 UIApplicationMain + 1080
24 Wohnungssuche 0x000d5218 start + 40
No. 2:
Thread: Unknown Name (Crashed)
0 libobjc.A.dylib 0x35beb5d0 objc_msgSend + 16 + 15
1 UIKit 0x39fb0541 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 409 + 408
2 UIKit 0x39f95361 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1317 + 1316
3 UIKit 0x39fac7ff -[UITableView layoutSubviews] + 207 + 206
4 UIKit 0x39f68897 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 259 + 258
5 QuartzCore 0x34ab74eb -[CALayer layoutSublayers] + 215 + 214
6 QuartzCore 0x34ab708d _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 461 + 460
7 QuartzCore 0x34ab7fb1 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 17 + 16
8 QuartzCore 0x34ab799b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 239 + 238
9 QuartzCore 0x34ab77ad _ZN2CA11Transaction6commitEv + 317 + 316
10 QuartzCore 0x34aee7df _ZN2CA7Display11DisplayLink8dispatchEyy + 255 + 254
11 QuartzCore 0x34aee6d9 _ZN2CA7Display16IOMFBDisplayLink8callbackEP21__IOMobileFramebufferyyyPv + 65 + 64
12 IOMobileFramebuffer 0x375f0fd7 IOMobileFramebufferVsyncNotifyFunc + 155 + 154
13 IOKit 0x3282a5ad IODispatchCalloutFromCFMessage + 193 + 192
14 CoreFoundation 0x3918288b __CFMachPortPerform + 119 + 118
15 CoreFoundation 0x3918d3e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35 + 34
16 CoreFoundation 0x3918d38b __CFRunLoopDoSource1 + 139 + 138
17 CoreFoundation 0x3918c20f __CFRunLoopRun + 1383 + 1382
18 CoreFoundation 0x390ff23d CFRunLoopRunSpecific + 357 + 356
19 CoreFoundation 0x390ff0c9 CFRunLoopRunInMode + 105 + 104
20 GraphicsServices 0x3344933b GSEventRunModal + 75 + 74
21 UIKit 0x39fb9291 UIApplicationMain + 1121 + 1120
Thanks for your help!
The crash point in both cases is the same:
UIKit 0x39fb0541 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 409 + 408
In the first case, the table view was trying to call a method on an instance that does not implement said method. The second crash was caused by trying to message garbage.
Thus, the most likely conclusion is that both crashes are symptoms of a single problem; you have an object that is being prematurely released or over-released.
In particular, your table view's data source is being released before or while a table is reloading.
I suspect that UITableView is trying to call the data source's method to create a cell. You could confirm this by setting a breakpoint on said method and looking at the stack trace. If my bet is correct, you'll see the _createPreparedCellForGlobal... method in the trace.
Without knowing details of your app, hard to say. Most likely, this is timing related issue between data being loaded on the screen and the user doing something that causes a request to be canceled earlier than the table view is done loading, causing your data source to be deallocated out from under the table (which can happen because the table view has an assign reference to your object; a non-retaining reference).
To try and reproduce, focus on:
• slow network connection or variable bandwidth (if your app is client/server)
• do things the user might do that causes operations to cancel
• quickly navigate between views without waiting for the update to complete drawing
In your comments, you mention that you are trying on "two different iPhones". Try on other device types and across different network configurations.

Resources