i have a strange reaction with my app.
My app is working fine in almost 10 different devices and also has passed the tests and it's online. But one friend that has iPhone 5s with iOS 9.1 has an issue. When he tries to enter to a table view, which i append items to it with an API call with alamofire and swiftyjson.. the app crashes. From crashlytics i get this strange error
Crashed: com.apple.main-thread
0 Events Near Me 0x1000a532c specialized listMapViewController.tableView(UITableView, cellForRowAtIndexPath : NSIndexPath) -> UITableViewCell (listMapViewController.swift:196)
1 Events Near Me 0x1000a3c94 #objc listMapViewController.tableView(UITableView, cellForRowAtIndexPath : NSIndexPath) -> UITableViewCell (listMapViewController.swift)
2 UIKit 0x18a37220c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 688
3 UIKit 0x18a372364 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
4 UIKit 0x18a3617b8 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2440
5 UIKit 0x18a376f0c -[UITableView _performWithCachedTraitCollection:] + 104
6 UIKit 0x18a10f22c -[UITableView layoutSubviews] + 176
7 UIKit 0x18a01f7ac -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 644
8 QuartzCore 0x18981eb58 -[CALayer layoutSublayers] + 148
9 QuartzCore 0x189819764 CA::Layer::layout_if_needed(CA::Transaction*) + 292
10 QuartzCore 0x189819624 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
11 QuartzCore 0x189818cc0 CA::Context::commit_transaction(CA::Transaction*) + 252
12 QuartzCore 0x189818a08 CA::Transaction::commit() + 512
13 QuartzCore 0x1898120f8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
14 CoreFoundation 0x184a47bd0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
15 CoreFoundation 0x184a45974 __CFRunLoopDoObservers + 372
16 CoreFoundation 0x184a45da4 __CFRunLoopRun + 928
17 CoreFoundation 0x184974ca0 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x18fbb0088 GSEventRunModal + 180
19 UIKit 0x18a08cffc UIApplicationMain + 204
20 Events Near Me 0x100095eec main (AppDelegate.swift:15)
21 libdyld.dylib 0x199da28b8 start + 4
And in the line 196 this is the code
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! locationEventsTableViewCell
var dict = arrRes[indexPath.row]
cell.eventTitle.text = dict["eventName"] as? String //here is the issue
So to explain you a bit, with this app you get some events near you depending on your location. I have a protection if there are no events there is a message. But we leave a couple of blocks away and i can get events, among with the cell.eventTitle... but my friend's iPhone crashes through it.
Any idea?
P.S. i'm now downloading iOS 9.1 to my simulator. Another friend with iPhone 5 doesnt have that issue.
As you say that other iphones doesn't have this problem I assumed that your friend's iphone maybe is overloaded from apps or anything else and it doesn't take the json variables in time!
So I suggest first to use if statements to avoid errors like this:
if dict["eventName"] as? String != nil {
cell.eventTitle.text = dict["eventName"] as? String
}
And if you want in your next update maybe you could use completions to reload your tableView data.
Hope it helps.
Related
Main problem about error is that I can't reproduce, It happens at random and on real device only. I have tried to understand below-attached crash code but I can't pinpoint the cause of the error.
This is the error log I got from bugsnag.
EXC_BREAKPOINT
_mh_execute_header
Sep 25th, 2019, 12:58:44 UTC
stacktrace
CrashReporter Key: 8bb746843e8011836dacb8dbaddb955d011045ee
Hardware Model: iPhone7,1
Process: vrs_v2
Identifier: com.visualregistration.v2
Version: 2.0
OS Version: iOS 12.4.1
EXC_BREAKPOINT:
0 vrs_v2 function signature specialization <Arg[0] = Dead> of vrs_v2.QuestionAnswerVC.tableView(_: __C.UITableView, cellForRowAt: Foundation.IndexPath) -> __C.UITableViewCell (<compiler-generated>)
1 vrs_v2 tableView (<compiler-generated>)
2 UIKitCore -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
3 UIKitCore -[UITableView _createPreparedCellForGlobalRow:willDisplay:]
4 UIKitCore -[UITableView _updateVisibleCellsNow:isRecursive:]
5 UIKitCore -[UITableView layoutSubviews]
6 UIKitCore -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
7 QuartzCore -[CALayer layoutSublayers]
8 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*)
9 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
10 QuartzCore CA::Transaction::commit()
11 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
12 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
13 CoreFoundation ___CFRunLoopDoObservers
14 CoreFoundation ___CFRunLoopRun
15 CoreFoundation _CFRunLoopRunSpecific
16 GraphicsServices _GSEventRunModal
17 UIKitCore _UIApplicationMain
18 vrs_v2 main (UsersListCell.swift:26:7)
19 libdyld.dylib _start
THREADS
Thread 0
Error reported from this thread
0 vrs_v2 tableView (QuestionAnswerVC.swift:137:14)
1 vrs_v2 arrAnswers.get (QuestionAnswerVC.swift)
2 vrs_v2 tableView (<compiler-generated>)
3 UIKitCore -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
4 UIKitCore -[UITableView _createPreparedCellForGlobalRow:willDisplay:]
5 UIKitCore -[UITableView _updateVisibleCellsNow:isRecursive:]
6 UIKitCore -[UITableView layoutSubviews]
7 UIKitCore -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8 QuartzCore -[CALayer layoutSublayers]
9 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*)
10 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
11 QuartzCore CA::Transaction::commit()
12 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
13 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
14 CoreFoundation ___CFRunLoopDoObservers
15 CoreFoundation ___CFRunLoopRun
16 CoreFoundation _CFRunLoopRunSpecific
17 GraphicsServices _GSEventRunModal
18 UIKitCore _UIApplicationMain
19 vrs_v2 main (UsersListCell.swift:26:7)
20 libdyld.dylib _start
I do not know why this is happening.
This is a code block where the crash happened according to the crash report
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tblList.dequeueReusableCell(withIdentifier: "QuesAnswerCell") as! QuesAnswerCell
cell.lblQuestion.text = arrQuestions[indexPath.row]
cell.selectionStyle = .none
cell.btnComment.tag = indexPath.row
var answer = ""
if let ans = arrAnswers[indexPath.row].done {
switch ans {
case 0:
answer = "yes".localized
break
case 1:
answer = "no".localized
break
case 2:
answer = "deviation".localized
break
default:
print("nothing")
}
}
if answer != "" {
cell.lblAnswer.textColor = UIColor.activeGreen
cell.lblAnswer.text = answer
}
if let comment = arrAnswers[indexPath.row].comments {
if comment == "" {
cell.btnComment.isHidden = true
} else {
cell.btnComment.isHidden = false
}
}
if let imgHash = arrAnswers[indexPath.row].images {
if imgHash.count > 0 {
cell.arrImgData = imgHash
cell.imgDataCollection.reloadData()
cell.imgCollHeight.constant = 162
} else {
cell.imgCollHeight.constant = 0
}
}
return cell
}
and line 137 is
cell.btnComment.tag = indexPath.row
I don't know why it can be crashed at this line.
Any help will be much appreciated.
check your code there will be a breakpoint which you are forgot to disable.
I have an ios app in Swift.The app runs fine and does not crash when uploaded locally from xcode. But the app is crashing when uploaded from testflight.
I found that there is nothing wrong in code.
I have implemented Crashlytics in my app, it has given following report.
Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x0000000100160fe4
Crashed: com.apple.main-thread
0 App 0x100160fe4 HomeViewController.viewDidLoad() -> () (HomeViewController.swift:57)
1 App 0x100161014 #objc HomeViewController.viewDidLoad() -> () (HomeViewController.swift)
2 UIKit 0x18c373ec0 -[UIViewController loadViewIfRequired] + 1036
3 UIKit 0x18c38b94c -[UIViewController __viewWillAppear:] + 132
4 UIKit 0x18c5101d4 -[UINavigationController _startCustomTransition:] + 1144
5 UIKit 0x18c42ab78 -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
6 UIKit 0x18c42a7e0 -[UINavigationController __viewWillLayoutSubviews] + 64
7 UIKit 0x18c42a744 -[UILayoutContainerView layoutSubviews] + 188
8 UIKit 0x18c37107c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
9 QuartzCore 0x189561274 -[CALayer layoutSublayers] + 148
10 QuartzCore 0x189555de8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
11 QuartzCore 0x189555ca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore 0x1894d134c CA::Context::commit_transaction(CA::Transaction*) + 252
13 QuartzCore 0x1894f83ac CA::Transaction::commit() + 504
14 QuartzCore 0x1894f8e78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
15 CoreFoundation 0x1861f09a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
16 CoreFoundation 0x1861ee630 __CFRunLoopDoObservers + 372
17 CoreFoundation 0x1861eea7c __CFRunLoopRun + 956
18 CoreFoundation 0x18611eda4 CFRunLoopRunSpecific + 424
19 GraphicsServices 0x187b88074 GSEventRunModal + 100
20 UIKit 0x18c3d9058 UIApplicationMain + 208
21 App 0x1000d8688 main (NewProductData.swift:18)
22 libdyld.dylib 0x18512d59c start + 4
I am not understanding anything from this reports, please help me out if anyone knows.
Here is viewDidload
override func viewDidLoad() {
super.viewDidLoad()
Giving instance of HomeViewController to AppDelegate
let appDele = UIApplication.shared.delegate as! AppDelegate
appDele.homeVC = self
token = FIRInstanceID.instanceID().token()!
//Method to handle Firebase token
UserDefaults.standard.set(token, forKey: "Notificationtoken")
print("####################### token provided is \(String(describing: token))")
let tokenstr = UserDefaults.standard.value(forKey: "Notificationtoken") as! String
if(token == tokenstr){
handleFCMToken(token: tokenstr)
}
else{
handleFCMToken(token: token!)
}
setUpNavBar()
setPopUpImage()
setUpcarousel()
setUpDelegates()
let help = Helper()
help.setUpGoogleAnalytics(screenName: "Home")
self.presenter = HomeViewPresenter(homeView: self)
presenter.getCarousel()
if(showProfile){
ProfileClicked()
}
// Do any additional setup after loading the view.
}
And here is viewWillAppear
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setUpUI()
}
and method of setupUI
func setUpUI(){
let wholesaler:Wholesaler = Helper.getWsProfile()
DispatchQueue.main.async {
self.wholesalerName.text = "Hello, \(wholesaler.wholesaler_name)"
self.pdsPoints.text = "\(wholesaler.pdsPoints!)"
self.visibilityPoints.text = "\(wholesaler.visibilityPoins!)"
}
iconNameString = ["SMS","Customer\n Groups","Visibility\n Contest","My\n Earnings","\(wholesaler.lastSchemeMonth!)\n Schemes","App\n News", "", "Contact\n Us"]
}
I think that viewing some code of your HomeViewController will give us more insight.
But here some comments:
Not sure about the full stack, but its seems weird that viewWillAppear is being called before viewDidLoad for some reason. Are you calling super correctly on those corresponding methods?
Have you try profiling the app using instruments in release mode vs debug mode? You can manage this on your schema settings.
Another hint, but I think it kind of advanced for your scenario, is the optimization level. Go to your target settings and search for Optimization Level, you'll notice it is different for debug and release. Sometimes complex algorithms with multiple blocks and/or threads may be affected by this.
Home it helps
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
I'm having an exception in my didSelectRowAtIndexPath method and i'm not quite sure why. I'm showing the user a list of possibilities they can select from, the UITableView is populated based on values stored in Core Data. The currently selected item has a Checkmark indicator. My method is below:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
let value = self.fetchedResultsController.objectAtIndexPath(indexPath) as CoreDataObject
currentSelected = value.id as Int
self.tableView.reloadData()
}
In development mode it's fine, but in production and testflight it crashes in this method. The crash log is below:
Crashed Thread 0 :
0 CoreFoundation 0x25f41a7d _CFRetain + 165
1 UIKit 0x29619d67 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 919
2 UIKit 0x296cb9df -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 195
3 UIKit 0x2957da25 _applyBlockToCFArrayCopiedToStack + 309
4 UIKit 0x294f982b _afterCACommitHandler + 459
5 CoreFoundation 0x26007d95 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21
6 CoreFoundation 0x26005453 __CFRunLoopDoObservers + 279
7 CoreFoundation 0x2600585b __CFRunLoopRun + 915
8 CoreFoundation 0x25f533c1 CFRunLoopRunSpecific + 477
9 CoreFoundation 0x25f531d3 CFRunLoopRunInMode + 107
10 GraphicsServices 0x2d3510a9 GSEventRunModal + 137
11 UIKit 0x29562fa1 UIApplicationMain + 1441
Is there anything i'm missing here? Why is this method crashing? I'm simply storing the currently selected ID and then reloading data so that it can show a checkmark after the reload. Is there something i'm missing here? It should be as simple as just getting the new id and then reloading the data.
The CoreDataObject that i'm using is from Objective-C and the id field is an NSNumber.
I tried other solutions below:
Crash when calling selectRowAtIndexPath:animated:scrollPosition:
iphone app crash at -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]
iOS - didSelectRowAtIndexPath causes crash in app
In case anybody else has this issue. currentSelected was a global variable declared as Int and the value object has an id field thats `NSNumber. I changed it to the below and it works:
self.currentSelected = value.id.integerValue
I've been trying to fix a crash that around 50% of my users are having. The crash began after I implemented a UISearchDisplayController (ie. added a search bar to a table view), but I haven't been able to reproduce the crash, not even once. According to my users, they instantly crash (or freeze) when they open the table view that has the UISearchDisplayController.
According to Crashlytics, the crash is happening at:
-[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:]
I've created the UITableView programmatically, but I've added the UISearchBar/UISearchDisplayController mostly via IB.
Regarding the "table header background view" that the crash seems to be referring to, I was doing two things previously. Firstly, I was setting the table views background view to nil:
[self.tableView setBackgroundView:nil];
Secondly, I was also doing this:
- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section
{
if (aTableView != nil && self.searchDisplayController != nil)
{
if (self.searchDisplayController.isActive)
{
return nil;
}
else
{
return [super sectionAtIndex:section].headerTitle;
}
}
else
{
return [super sectionAtIndex:section].headerTitle;
}
}
I've since then change the background view to a __strong UIView with a frame size of CGZero, meaning I've just added a strong, empty view to the background.
Additionally, in the second piece of code, instead of returning nil, I'm now returning an empty string, #"".
I haven't pushed these changes to my users yet, because I want to be sure before I do so. Tried to google the UISearchDisplayController function but didn't really find anything, so I'm guessing it's an iOS 7-specific issue, which makes it even harder to track down, especially since I can't reproduce it.
Anyway, I'm hoping that someone has either experienced this kind of problem themselves, or that someone has some sort of idea on what could be causing this.
UPDATE: Here's the full crash.
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x0000000191f179d0 objc_msgSend + 16
1 UIKit 0x0000000188f63820 -[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:] + 164
2 UIKit 0x0000000188f63394 -[UISearchBar _didMoveFromWindow:toWindow:] + 312
3 UIKit 0x0000000188e6e42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 684
4 UIKit 0x0000000188e9280c -[UIScrollView _didMoveFromWindow:toWindow:] + 68
5 UIKit 0x0000000188e6dba0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 148
6 UIKit 0x0000000188e6d998 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
7 UIKit 0x0000000188e7c4ec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1628
8 UIKit 0x000000018906af44 -[_UIParallaxDimmingView didMoveToWindow] + 144
9 UIKit 0x0000000188e6e768 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1512
10 UIKit 0x0000000188e6e42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 684
11 UIKit 0x0000000188e6dba0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 148
12 UIKit 0x0000000188e6d998 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
13 UIKit 0x0000000188e7c4ec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1628
14 UIKit 0x000000018906a67c __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1636
15 UIKit 0x0000000188e82bb8 +[UIView(Animation) performWithoutAnimation:] + 88
16 UIKit 0x0000000189069d54 -[_UINavigationParallaxTransition animateTransition:] + 828
17 UIKit 0x0000000189022078 -[UINavigationController _startCustomTransition:] + 2724
18 UIKit 0x0000000188f2c794 -[UINavigationController _startDeferredTransitionIfNeeded:] + 464
19 UIKit 0x0000000188f2c564 -[UINavigationController __viewWillLayoutSubviews] + 56
20 UIKit 0x0000000188f2c4e4 -[UILayoutContainerView layoutSubviews] + 200
21 UIKit 0x0000000188e6ed78 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 348
22 QuartzCore 0x0000000188a6b0cc -[CALayer layoutSublayers] + 184
23 QuartzCore 0x0000000188a65c94 CA::Layer::layout_if_needed(CA::Transaction*) + 300
24 QuartzCore 0x0000000188a65b4c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
25 QuartzCore 0x0000000188a653d4 CA::Context::commit_transaction(CA::Transaction*) + 280
26 QuartzCore 0x0000000188a65178 CA::Transaction::commit() + 424
27 QuartzCore 0x0000000188a5ea30 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
28 CoreFoundation 0x0000000185f5f7e0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
29 CoreFoundation 0x0000000185f5ca68 __CFRunLoopDoObservers + 372
30 CoreFoundation 0x0000000185f5cdf4 __CFRunLoopRun + 764
31 CoreFoundation 0x0000000185e9db38 CFRunLoopRunSpecific + 452
32 GraphicsServices 0x000000018b8c3830 GSEventRunModal + 168
33 UIKit 0x0000000188edc0e8 UIApplicationMain + 1156
34 Flash Reader 0x00000001000904dc main + 17 (main.m:17)
35 libdyld.dylib 0x0000000192507aa0 start + 4
UPDATE 2:
It seems like this is only happening on an iPhone 5S and that would also explain why I'm unable to reproduce this. I have a feeling that it's related to this block of code:
CGRect newBounds = self.tableView.bounds;
if (self.tableView.bounds.origin.y < 44)
{
newBounds.origin.y = newBounds.origin.y + self.searchDisplayController.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
}
// new for iOS 7
if (self.tableView != nil && self.staticContentSections.count > 0)
{
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:0 animated:YES];
}
I'm hoping that this is what causes the crash, because if so, I'm hoping to fix this by just doing this in viewWillAppear:
self.edgesForExtendedLayout = UIRectEdgeNone;
self.tableView.contentOffset = CGPointMake(0, 44);
UPDATE 3:
Well, that didn't fix it. This is still happening, either randomly or each time when the user has an iPhone 5S. It doesn't happen in the 5S simulator, but I can't debug it any further since I don't own a 5S. I'm starting to think that this is an iOS 7 bug, not a bug with the app itself.
I got the crash in iOS 8.0. I fixed it by setting searchBar.delegate = nil in dealloc (deinit) of the view controller.