I have no any idea about tihs break,
Can you provide some clues for me, Any help would be appreciated.
thread #1: tid = 0x29927, 0x37c47b66 libobjc.A.dylib`objc_msgSend + 6, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x8000000c)
frame #0: 0x37c47b66 libobjc.A.dylib`objc_msgSend + 6
frame #1: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #2: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #3: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #4: 0x30118732 UIKit`-[UIResponder resignFirstResponder] + 250
frame #5: 0x3027bb68 UIKit`-[UIWebDocumentView resignFirstResponder] + 232
frame #6: 0x3027ba7c UIKit`-[UIWebBrowserView resignFirstResponder] + 124
frame #7: 0x30072504 UIKit`-[UIView(Hierarchy) _willMoveToWindow:] + 660
frame #8: 0x30072d74 UIKit`__85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 76
frame #9: 0x30072ca2 UIKit`-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 378
frame #10: 0x30072d94 UIKit`__85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 108
frame #11: 0x30072ca2 UIKit`-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 378
frame #12: 0x3007fb9a UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 418
frame #13: 0x3014490c UIKit`-[UITableViewCell _addSubview:positioned:relativeTo:] + 88
frame #14: 0x3007f9f2 UIKit`-[UIView(Hierarchy) addSubview:] + 30
frame #15: 0x00068b2e 4399Games1.0`-[SJGameDetailController tableView:cellForRowAtIndexPath:](self=0x162c8e00, _cmd=0x3065c3d7, tableView=0x163b0c00, indexPath=0x19172ab0) + 6478 at SJGameDetailController.m:1515
frame #16: 0x301a6314 UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 408
frame #17: 0x3014e6cc UIKit`-[UITableView _updateVisibleCellsNow:] + 1800
frame #18: 0x3014def0 UIKit`-[UITableView layoutSubviews] + 184
frame #19: 0x30074352 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 346
frame #20: 0x2fcfa942 QuartzCore`-[CALayer layoutSublayers] + 142
frame #21: 0x2fcf6166 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 350
frame #22: 0x2fcf5ff8 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #23: 0x2fcf5a0c QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 228
frame #24: 0x2fcf581e QuartzCore`CA::Transaction::commit() + 314
frame #25: 0x2fcef54c QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
frame #26: 0x2d8baf68 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
frame #27: 0x2d8b88f6 CoreFoundation`__CFRunLoopDoObservers + 286
frame #28: 0x2d8b8c42 CoreFoundation`__CFRunLoopRun + 738
frame #29: 0x2d823470 CoreFoundation`CFRunLoopRunSpecific + 524
frame #30: 0x2d823252 CoreFoundation`CFRunLoopRunInMode + 106
frame #31: 0x3255d2ea GraphicsServices`GSEventRunModal + 138
frame #32: 0x300d8844 UIKit`UIApplicationMain + 1136
frame #33: 0x000498c8 4399Games1.0`main(argc=1, argv=0x27dbecfc) + 116 at main.m:16
Rayfleck is on right track.
When you want to close the keyboard due to a textfield somewhere in your view, use following & let iOS handle the responder chain
[self.view endEditing:YES];
This is really helpful when there is a table in the view and the table has textfields everywhere.
From Apple Doc:
- (BOOL)endEditing:(BOOL)force
Description
Causes the view (or one of its embedded text fields) to resign the first responder status.
This method looks at the current view and its subview hierarchy for the text field that is currently the first responder. If it finds one, it asks that text field to resign as first responder. If the force parameter is set to YES, the text field is never even asked; it is forced to resign.
Parameters
force
Specify YES to force the first responder to resign, regardless of whether it wants to do so.
Returns
YES if the view resigned the first responder status or NO if it did not.
I had the exact same problem with a UITextField. When I replaced
[myTextField resignFirstResponder];
with
[myTextField endEditing:YES];
the crashes stopped.
Related
I have an instance of UINavigationController nested in UITabBarController. I use the navigation controller to reach some view controller (tab bar still visible), from which I segue to a second view controller (tab bar no longer visible).
In the second view controller, as soon as I make a call to:
[self.navigationController setToolbarHidden:NO]
the app freezes and memory grows until OOM exception crashes it.
I acknowledge that nesting the navigation controller inside the tab bar is not recommended, but this setup seemed to work fine until iOS 11.
EDIT: when stopping execution, I see a lot of calls to:
UIView(UIConstraintBasedLayout)
UIView(AdditionalLayerSupport)
NSLayoutConstraint
Here's the full stack trace
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP * frame #0: 0x0000000106dd895c libobjc.A.dylib`objc_msgSend
+ 28
frame #1: 0x00000001067b6b9b Foundation`-[NSConcreteMapTable removeObjectForKey:] + 138
frame #2: 0x00000001069e6019 Foundation`_substituteOutAllOccurencesOfBodyVar + 1282
frame #3: 0x00000001067f3c5b Foundation`-[NSISEngine tryAddingDirectly:] + 144
frame #4: 0x00000001067f332f Foundation`-[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:]
+ 440
frame #5: 0x00000001069f2067 Foundation`-[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:]
+ 273
frame #6: 0x00000001067ea601 Foundation`-[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 240
frame #7: 0x0000000109c9488d UIKit`__57-[UIView(AdditionalLayoutSupport)
_switchToLayoutEngine:]_block_invoke_2 + 452
frame #8: 0x00000001067f0de1 Foundation`-[NSISEngine withBehaviors:performModifications:] + 131
frame #9: 0x0000000109c946a2 UIKit`__57-[UIView(AdditionalLayoutSupport)
_switchToLayoutEngine:]_block_invoke + 604
frame #10: 0x0000000109c9441e UIKit`-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 223
frame #11: 0x00000001091ed84f UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
frame #12: 0x00000001067f0de1 Foundation`-[NSISEngine withBehaviors:performModifications:] + 131
frame #13: 0x00000001091ed778 UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 855
frame #14: 0x00000001091fe031 UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1927
frame #15: 0x0000000109b507e1 UIKit`-[_UILayoutArrangement insertItem:atIndex:] + 502
frame #16: 0x0000000109ca1b4d UIKit`__50-[_UIOrderedLayoutArrangement insertItem:atIndex:]_block_invoke + 50
frame #17: 0x0000000109ca18df UIKit`-[_UIOrderedLayoutArrangement _trackChangesAffectingExternalBaselineConstraints:] + 320
frame #18: 0x0000000109ca1aea UIKit`-[_UIOrderedLayoutArrangement insertItem:atIndex:] + 478
frame #19: 0x000000010982edea UIKit`-[UIStackView insertArrangedSubview:atIndex:] + 283
frame #20: 0x0000000109b29972 UIKit`-[_UIButtonBar _layoutBar] + 3639
frame #21: 0x0000000109b2bb44 UIKit`-[_UIButtonBarStackView updateConstraints] + 48
frame #22: 0x0000000109c958b6 UIKit`-[UIView(AdditionalLayoutSupport)
_sendUpdateConstraintsIfNecessaryForSecondPass:] + 161
frame #23: 0x0000000109c95ed2 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 1296
frame #24: 0x0000000109c95d51 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 911
frame #25: 0x0000000109c95d51 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 911
frame #26: 0x0000000109c95d51 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 911
frame #27: 0x00000001067f0de1 Foundation`-[NSISEngine withBehaviors:performModifications:] + 131
frame #28: 0x0000000109c96703 UIKit`__100-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke
+ 90
frame #29: 0x0000000109c94f61 UIKit`-[UIView(AdditionalLayoutSupport)
_withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104
frame #30: 0x0000000109c96272 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 160
frame #31: 0x0000000109c9738c UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:]
+ 401
frame #32: 0x00000001091ef1b6 UIKit`-[UIView(Hierarchy) layoutBelowIfNeeded] + 1517
frame #33: 0x000000010957b35e UIKit`-[_UIButtonBarButton willMoveToWindow:] + 63
frame #34: 0x00000001091ec996 UIKit`-[UIView(Hierarchy) _willMoveToWindow:] + 861
frame #35: 0x00000001091eb493 UIKit`__UIViewWillBeRemovedFromSuperview + 484
frame #36: 0x00000001091eb0ea UIKit`-[UIView(Hierarchy) removeFromSuperview] + 95
frame #37: 0x0000000109b295d3 UIKit`-[_UIButtonBar _layoutBar] + 2712
frame #38: 0x0000000109b2bb44 UIKit`-[_UIButtonBarStackView updateConstraints] + 48
frame #39: 0x0000000109c958b6 UIKit`-[UIView(AdditionalLayoutSupport)
_sendUpdateConstraintsIfNecessaryForSecondPass:] + 161
frame #40: 0x0000000109c95ed2 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 1296
frame #41: 0x0000000109c95d51 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 911
frame #42: 0x0000000109c95d51 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 911
frame #43: 0x0000000109c95d51 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededCollectingViews:forSecondPass:] + 911
frame #44: 0x00000001067f0de1 Foundation`-[NSISEngine withBehaviors:performModifications:] + 131
frame #45: 0x0000000109c96703 UIKit`__100-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke
+ 90
frame #46: 0x0000000109c94f61 UIKit`-[UIView(AdditionalLayoutSupport)
_withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104
frame #47: 0x0000000109c96272 UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 160
frame #48: 0x0000000109c9738c UIKit`-[UIView(AdditionalLayoutSupport)
_updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:]
+ 401
frame #49: 0x00000001091efa5b UIKit`-[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 159
frame #50: 0x00000001095742d5 UIKit`-[UILayoutContainerView layoutSubviews] + 270
frame #51: 0x0000000109204551 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1331
frame #52: 0x00000001064db4ba QuartzCore`-[CALayer layoutSublayers] + 153
frame #53: 0x00000001064df5a9 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 401
frame #54: 0x00000001064681cd QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 365
frame #55: 0x0000000106493ae4 QuartzCore`CA::Transaction::commit() + 500
frame #56: 0x0000000109160687 UIKit`_afterCACommitHandler + 272
frame #57: 0x00000001080f8db7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
+ 23
frame #58: 0x00000001080f8d0e CoreFoundation`__CFRunLoopDoObservers + 430
frame #59: 0x00000001080dd324 CoreFoundation`__CFRunLoopRun + 1572
frame #60: 0x00000001080dca89 CoreFoundation`CFRunLoopRunSpecific + 409
frame #61: 0x000000010dc429c6 GraphicsServices`GSEventRunModal + 62
frame #62: 0x0000000109135d30 UIKit`UIApplicationMain + 159
frame #63: 0x0000000101ff6bf9 MyAppName`main(argc=1, argv=0x00007fff5de3e0a8) at main.m:23
frame #64: 0x000000010f453d81 libdyld.dylib`start + 1
frame #65: 0x000000010f453d81 libdyld.dylib`start + 1
This is the answer from a developer from the same team as OP is from.
After one more round of research we have found that the problem was on our side:
- (NSArray *)toolbarItems
{
return [self toolbarItemsWithRunningAdditionalAnimation:NO];
}
Original developer made the method toolbarItemsWithRunningAdditionalAnimation to return new objects each time the method was called. When going to this controller iOS calls toolbarItems at least 3 times so giving it new objects every time we made iOS confused so it was recalculating auto-layout constraints in an infinite loop. Our original fix below is also working, however it becomes obsolete as we start always returning the same array of items like:
- (NSArray *)toolbarItems {
if (_cachedToolbarItems) { return _cachedToolbarItems; }
_cachedToolbarItems = [self toolbarItemsWithRunningAdditionalAnimation:NO];
return _cachedToolbarItems'
}
We are doing the following in our app (pseudocode):
UIToolbar *toolbar = self.navigationController.toolbar;
NSArray <UIBarButtonItem *> *items = #[
flexibleSpace,
share,
flexibleSpace,
play,
flexibleSpace,
stats,
flexibleSpace
];
[toolbar setItems:items animated:animated];
[self.navigationController setToolbarHidden:NO animated:animated];
The problematic items that caused infinite calculation of auto-layout constraints were share and stats. The thing they both had in common - they both were created using -[UIBarButtonItem initWithImage:style:target:action:] initializer. When we started using another initializer:
UIButton *customShareButton = ... // we create button ourselves.
UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithCustomView: customShareButton];
The problem went away.
Besides the accepted answer, we found that our problem was related to the fact that in our class, we override the method
- (NSArray *)toolbarItems.
Every time our method is called, a new set of toolbarItems is created.
Seems like from iOS 11, every time new toolbar items are returned to this method, UINavigationController:layoutIfNeeded is called again, which in turn calls toolbarItems which returns new items because of our implementation. This causes an infinite loop.
If you encounter this problem, check if you are overriding - (NSArray *)toolbarItems
I am new to Objective C, and cannot figure out the error I am facing right now. The app was developed by some other developer few years back, and I just have to change some images and upload back as new version (and underline API/webservice got updated). Everything was done fine, but one button in app is causing a crash.
We have two button in our main interface, one shows the listing near by user location, which works, and we have another to show all listing. The calling method for them is same, but when we use Show all listing interface in code it crash application with no error. in Debugger it shows (lldb) and generate SIGABRT in main appdelegate call.
Here is the button code
-(IBAction)btnAllResturantAction:(id)sender
{
[btnAllRestaruant setImage:[UIImage imageNamed:#"all_restaurants_tapped.png"] forState:UIControlStateNormal];
NSLog(#"SearchView : Button CLick for All Resturant");
#try {
HomeViewController *homeView1=[[HomeViewController alloc]initWithNibName:#"HomeViewController" bundle:nil];
[self.navigationController pushViewController:homeView1 animated:YES];
NSLog(#"SearchView: Button CLick complete");
} #catch (NSException *exception){
NSLog(#"Search View: Exception in All Resturant %#", exception.reason);
}
}
When in line by line debug, I can see Log message of "Button Click complete" visible in debugger window, but just after that it fail and crash application, I didn't see any other error message even after I try bt in Debugger window, it shows all framework code. Here is bt result anyways
* thread #1: tid = 0x129d3, 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x04617664 libsystem_pthread.dylib`pthread_kill + 101
frame #2: 0x043c539d libsystem_c.dylib`abort + 156
frame #3: 0x002ff065 project6`uncaught_exception_handler + 38
frame #4: 0x03eabebe CoreFoundation`__handleUncaughtException + 830
frame #5: 0x0396d0ae libobjc.A.dylib`_objc_terminate() + 100
frame #6: 0x04687d0d libc++abi.dylib`std::__terminate(void (*)()) + 14
frame #7: 0x0468793e libc++abi.dylib`__cxa_rethrow + 103
frame #8: 0x0396cfad libobjc.A.dylib`objc_exception_rethrow + 47
frame #9: 0x03dba7d0 CoreFoundation`CFRunLoopRunSpecific + 672
frame #10: 0x03dba51b CoreFoundation`CFRunLoopRunInMode + 123
frame #11: 0x056ef664 GraphicsServices`GSEventRunModal + 192
frame #12: 0x056ef4a1 GraphicsServices`GSEventRun + 104
frame #13: 0x006941eb UIKit`UIApplicationMain + 160
frame #14: 0x000abf7a project6`main(argc=1, argv=0xbff5587c) + 138 at main.m:14
frame #15: 0x0431ea21 libdyld.dylib`start + 1
Can you guide me where and how I look for error, with this information.
EDIT:
I add Exception Breakpoint which generate this bt
(lldb) bt
thread #1: tid = 0x1368d, 0x03996dd0 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
frame #0: 0x03996dd0 libobjc.A.dylib`objc_exception_throw
frame #1: 0x03ed59ad CoreFoundation`+[NSException raise:format:] + 141
frame #2: 0x008873cb UIKit`-[UIViewController _loadViewFromNibNamed:bundle:] + 740
frame #3: 0x00887ccc UIKit`-[UIViewController loadView] + 189
frame #4: 0x008880d8 UIKit`-[UIViewController loadViewIfRequired] + 154
frame #5: 0x0088ebde UIKit`-[UIViewController __viewWillAppear:] + 114
frame #6: 0x008b1d37 UIKit`-[UIViewController(UIContainerViewControllerProtectedMethods) beginAppearanceTransition:animated:] + 202
frame #7: 0x008c4009 UIKit`-[UINavigationController _startCustomTransition:] + 1389
frame #8: 0x008d5bf5 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 803
frame #9: 0x008d6e3b UIKit`-[UINavigationController __viewWillLayoutSubviews] + 68
frame #10: 0x00ab2193 UIKit`-[UILayoutContainerView layoutSubviews] + 252
frame #11: 0x00787eb7 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 813
frame #12: 0x039ab059 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #13: 0x0586780a QuartzCore`-[CALayer layoutSublayers] + 144
frame #14: 0x0585b4ee QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 388
frame #15: 0x0585b352 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #16: 0x0584de8b QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 317
frame #17: 0x05881e03 QuartzCore`CA::Transaction::commit() + 561
frame #18: 0x05883674 QuartzCore`CA::Transaction::flush_transaction() + 50
frame #19: 0x006b7f0a UIKit`_UIApplicationHandleEventQueue + 8398
frame #20: 0x03defd1f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
frame #21: 0x03de59ab CoreFoundation`__CFRunLoopDoSources0 + 523
frame #22: 0x03de4dc8 CoreFoundation`__CFRunLoopRun + 1032
frame #23: 0x03de4706 CoreFoundation`CFRunLoopRunSpecific + 470
frame #24: 0x03de451b CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x05719664 GraphicsServices`GSEventRunModal + 192
frame #26: 0x057194a1 GraphicsServices`GSEventRun + 104
frame #27: 0x006be1eb UIKit`UIApplicationMain + 160
frame #28: 0x000d5f7a project6`main(argc=1, argv=0xbff2b87c) + 138 at main.m:14
frame #29: 0x04348a21 libdyld.dylib`start + 1
We are loading HTML with Select control (Drop Down) in UIWebView and when we click on Drop down, the app is crashing. This is happening only when text having lengthy text, but works fine with short Text.
When we debugged, we found its an issue with UILabel in UIPopoverController coming from UIWebView. When UILabel has text with 2 lines, this issue is happening, single line its fine. We are unable to identify the issue whether its with Storyboard or Settings...etc.
Any help will be much appreciated.
Here is the Crash
* thread #1: tid = 0x1bd3, 0x034ad930 CoreFoundation`CFArrayGetValueAtIndex + 112, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x034ad930 CoreFoundation`CFArrayGetValueAtIndex + 112
frame #1: 0x007d1b41 CoreText`TCharStream::CopyBreakIterator(__CFString const*) + 261
frame #2: 0x007d18f4 CoreText`TCharStream::FindLineBreak(CFRange, bool, __CFString const*) const + 246
frame #3: 0x00758a4a CoreText`TTypesetter::SuggestLineBreak(TLine const&, long, double, double) + 328
frame #4: 0x007586b9 CoreText`CTLineSuggestLineBreakWithOffset + 55
frame #5: 0x0839d89f UIFoundation`__NSStringDrawingEngine + 20275
frame #6: 0x08398940 UIFoundation`-[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 201
frame #7: 0x01b265c1 UIKit`-[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 1425
frame #8: 0x01b25e7e UIKit`-[UILabel textRectForBounds:limitedToNumberOfLines:] + 85
frame #9: 0x01d1d0cb UIKit`-[UITableViewCellLayoutManager intrinsicContentSizeForCell:] + 554
frame #10: 0x01c16594 UIKit`-[UITableViewCell sizeThatFits:] + 46
frame #11: 0x02092ade UIKit`-[UIView(UIConstraintBasedLayout) systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 130
frame #12: 0x01c01c9f UIKit`-[UITableViewCell systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 220
frame #13: 0x01a3f847 UIKit`-[UITableView _heightForCell:atIndexPath:] + 386
frame #14: 0x01a302fb UIKit`__53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 2244
frame #15: 0x019987af UIKit`+[UIView(Animation) performWithoutAnimation:] + 82
frame #16: 0x019987f8 UIKit`+[UIView(Animation) _performWithoutAnimation:] + 40
frame #17: 0x01a2fa2f UIKit`-[UITableView _configureCellForDisplay:forIndexPath:] + 355
frame #18: 0x01a381da UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 503
frame #19: 0x01a3829e UIKit`-[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 77
frame #20: 0x01a11a6b UIKit`-[UITableView _updateVisibleCellsNow:isRecursive:] + 3034
frame #21: 0x01a2c3d1 UIKit`-[UITableView layoutSubviews] + 222
frame #22: 0x019a1dd1 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
frame #23: 0x02f55771 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #24: 0x0061f28f QuartzCore`-[CALayer layoutSublayers] + 152
frame #25: 0x00613115 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 397
frame #26: 0x00612f70 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #27: 0x005713c6 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 284
frame #28: 0x0057278c QuartzCore`CA::Transaction::commit() + 392
frame #29: 0x00572e58 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #30: 0x034fa9de CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #31: 0x034fa920 CoreFoundation`__CFRunLoopDoObservers + 400
frame #32: 0x034f035a CoreFoundation`__CFRunLoopRun + 1226
frame #33: 0x034efbcb CoreFoundation`CFRunLoopRunSpecific + 443
frame #34: 0x034ef9fb CoreFoundation`CFRunLoopRunInMode + 123
frame #35: 0x04d4224f GraphicsServices`GSEventRunModal + 192
frame #36: 0x04d4208c GraphicsServices`GSEventRun + 104
frame #37: 0x019168b6 UIKit`UIApplicationMain + 1526
* frame #38: 0x000f85bd main(argc=1, argv=0xbff5e584) + 141 at main.m:16
frame #39: 0x04400ac9 libdyld.dylibstart + 1
Thanks,
Vijay
This is a duplicate, see my answer here: https://stackoverflow.com/a/26692948/4206060
In short, put this into your web view delegate:
-(void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion
{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_USEC), dispatch_get_main_queue(),
^{
[super presentViewController:viewControllerToPresent animated:flag completion:completion];
});
}
This is solved. The issue was because of hardcoding "AppleLanguages" NSDefaults Key to a String. When UIWebview tries to show UILabel it tries to fetch AppleLanguages as Array and crashing.
I tried using NSZobie and all others. Still i face issues. can't able to find where app crashed. Please Help. thanks in advance.
*** -[UIView _forgetDependentConstraint:]: message sent to deallocated instance 0x208e0010
(lldb) bt
* thread #1: tid = 0x2503, 0x342b3468 CoreFoundation`___forwarding___ + 192, stop reason = EXC_BREAKPOINT (code=EXC_ARM_B`enter code here`REAKPOINT, subcode=0xdefe)
frame #0: 0x342b3468 CoreFoundation`___forwarding___ + 192
frame #1: 0x3420af68 CoreFoundation`__forwarding_prep_0___ + 24
frame #2: 0x364f24ba UIKit`_updateViewDependenciesForConstraint + 202
frame #3: 0x364f9a2c UIKit`__72-[UIView(AdditionalLayoutSupport) _removeRelevantConstraintsFromEngine:]_block_invoke_0 + 264
frame #4: 0x34c65882 Foundation`-[NSISEngine withAutomaticOptimizationDisabled:] + 166
frame #5: 0x364f98ee UIKit`-[UIView(AdditionalLayoutSupport) _removeRelevantConstraintsFromEngine:] + 94
frame #6: 0x3629f4a0 UIKit`__UIViewWillBeRemovedFromSuperview + 588
frame #7: 0x360e7848 UIKit`-[UIView(Hierarchy) removeFromSuperview] + 56
frame #8: 0x36137f18 UIKit`-[UINavigationTransitionView _cleanupTransition] + 92
frame #9: 0x360ceab2 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 158
frame #10: 0x361438ee UIKit`-[UIViewAnimationState animationDidStop:finished:] + 50
frame #11: 0x35e78c00 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 208
frame #12: 0x3c3f04b6 libdispatch.dylib`_dispatch_client_callout + 22
frame #13: 0x3c3f51bc libdispatch.dylib`_dispatch_main_queue_callback_4CF$VARIANT$mp + 224
frame #14: 0x34284f3a CoreFoundation`__CFRunLoopRun + 1290
frame #15: 0x341f7ebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #16: 0x341f7d48 CoreFoundation`CFRunLoopRunInMode + 104
frame #17: 0x37dd02ea GraphicsServices`GSEventRunModal + 74
frame #18: 0x3610d300 UIKit`UIApplicationMain + 1120
frame #19: 0x000521de MyApp®`main(argc=1, argv=0x2fdb3cf8) + 162 at main.m:6
frame #20: 0x3c410b20 libdyld.dylib`start + 4
Check if you have UIAlertView or animations in view before came back to your view. It seems you are initalize a view with it's local variable, wihout having express use self delegate, or you use removeFromSuperview for a view while actions still call it after remove.
I'm working on a universal app and the iPhone version works just fine. I created a new nib for iPad and set the files owner to be the viewcontroller class. The I connected all the IBOutlets and IBActions. When I run the app on an iPad (and in the iPad simulator) it crashes when I touch any of the controls. I tried setting break points in the IBActions for each but it doesn't even make it to those before the crash happens. What's going on?
Backtrace:
* thread #1: tid = 0x1f03, 0x0189809b libobjc.A.dylibobjc_msgSend + 15, stop reason = EXC_BAD_ACCESS (code=2, address=0x15)
frame #0: 0x0189809b libobjc.A.dylibobjc_msgSend + 15
frame #1: 0x0020f14e UIKit-[UIApplication sendAction:to:from:forEvent:] + 96
frame #2: 0x0020f0e6 UIKit-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
frame #3: 0x002b5ade UIKit-[UIControl sendAction:to:forEvent:] + 66
frame #4: 0x002b5fa7 UIKit-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
frame #5: 0x002b5b13 UIKit-[UIControl sendActionsForControlEvents:] + 48
frame #6: 0x00304462 UIKit-[UISegmentedControl _setSelectedSegmentIndex:notify:] + 684
frame #7: 0x00305dd0 UIKit-[UISegmentedControl touchesBegan:withEvent:] + 1026
frame #8: 0x002342cf UIKit-[UIWindow sendTouchesForEvent:] + 272
frame #9: 0x002345e6 UIKit-[UIWindow sendEvent:] + 273
frame #10: 0x0021adc4 UIKit-[UIApplication sendEvent:] + 464
frame #11: 0x0020e634 UIKit_UIApplicationHandleEvent + 8196
frame #12: 0x021c0ef5 GraphicsServicesPurpleEventCallback + 1274
frame #13: 0x012a1195 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #14: 0x01205ff2 CoreFoundation_CFRunLoopDoSource1 + 146
frame #15: 0x012048da CoreFoundation__CFRunLoopRun + 2218
frame #16: 0x01203d84 CoreFoundationCFRunLoopRunSpecific + 212
frame #17: 0x01203c9b CoreFoundationCFRunLoopRunInMode + 123
frame #18: 0x021bf7d8 GraphicsServicesGSEventRunModal + 190
frame #19: 0x021bf88a GraphicsServicesGSEventRun + 103
frame #20: 0x0020c626 UIKitUIApplicationMain + 1163
frame #21: 0x00001d8d gravity`main + 141 at main.m:16
Turns out the view controller wasn't being retained due to ARC. So when I went back to send messages to it it crashed.