UIWebView Crashing on Drop Down - ios

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.

Related

Animation with CGAffineTransformScale freezes application

I am trying to implement a "disappearing" url bar, when the users scrolls in the webview.
The function below gets called in - (void)scrollViewDidScroll:(UIScrollView *)scrollView.
For specific webpages the app freezes completely and uses 100% CPU. From trial and error we concluded that removing the CGAffineTransformScale fixes this. I am trying to understand why this happens and how else I could implement the same functionality.
- (void)collapseQueryBox
{
_URLBarState = CLQURLBarStateCollapsing;
_queryBoxViewHeightConstraint.constant = COLLAPSED_QUERYBOX_HEIGHT;
[UIView animateWithDuration:COLLAPSE_ANIMATION_DURATION animations:^{
_webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
_queryLabel.transform = CGAffineTransformScale(_queryLabel.transform, COLLAPSE_ANIMATION_SCALE_FACTOR, COLLAPSE_ANIMATION_SCALE_FACTOR);
_queryLabel.layer.backgroundColor = [UIColor clearColor].CGColor;
[_browserContainerView layoutIfNeeded];
} completion:^(BOOL finished) {
_URLBarState = CLQURLBarStateCollapsed;
}];
}
The full stack trace of the paused app in the frozen state:
* thread #1: tid = 0xcbf9f, 0x025b40be libobjc.A.dylib`objc_msgSend + 26, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x025b40be libobjc.A.dylib`objc_msgSend + 26
frame #1: 0x008cf411 Foundation`-[NSISEngine variableToWorkOnAmongVariablesWithIntegralizationViolationsIgnoringLostCauses:varsAlreadyAdjusted:] + 491
frame #2: 0x00a41ea3 Foundation`__44-[NSISEngine fixupIntegralizationViolations]_block_invoke + 1285
frame #3: 0x00a4368c Foundation`-[NSISEngine withBehaviors:performModifications:] + 107
frame #4: 0x008cf21a Foundation`-[NSISEngine withoutOptimizingAtEndRunBlockWithAutomaticOptimizationDisabled:] + 48
frame #5: 0x008cf1d9 Foundation`-[NSISEngine fixupIntegralizationViolations] + 96
frame #6: 0x008ceef8 Foundation`-[NSISEngine optimize] + 204
frame #7: 0x008d57e3 Foundation`-[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 336
frame #8: 0x00a43e23 Foundation`-[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 489
frame #9: 0x00a4b2d5 Foundation`-[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 578
frame #10: 0x008c8d4f Foundation`-[NSLayoutConstraint _setSymbolicConstant:constant:] + 384
frame #11: 0x008cb6a1 Foundation`-[NSLayoutConstraint setConstant:] + 52
frame #12: 0x00e398a5 UIKit`-[UIScrollView setContentSize:] + 566
frame #13: 0x01030a5a UIKit`-[UITableViewCell _updateWrapperContentInset] + 117
frame #14: 0x0103963a UIKit`-[UITableViewCell setFrame:] + 701
frame #15: 0x00e1b7b0 UIKit`-[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 840
frame #16: 0x00e1c552 UIKit`-[UIView(Geometry) _resizeWithOldSuperviewSize:] + 290
frame #17: 0x00e1c5aa UIKit`-[UIView(Geometry) resizeWithOldSuperviewSize:] + 80
frame #18: 0x00e1b185 UIKit`__46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 87
frame #19: 0x028a1d86 CoreFoundation`__53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
frame #20: 0x028a1c5f CoreFoundation`-[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
frame #21: 0x00e1b115 UIKit`-[UIView(Geometry) resizeSubviewsWithOldSize:] + 149
frame #22: 0x00e19c4e UIKit`-[UIView(Geometry) setFrame:] + 559
frame #23: 0x00e1b7b0 UIKit`-[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 840
frame #24: 0x00e1c552 UIKit`-[UIView(Geometry) _resizeWithOldSuperviewSize:] + 290
frame #25: 0x00e1c5aa UIKit`-[UIView(Geometry) resizeWithOldSuperviewSize:] + 80
frame #26: 0x00e1b185 UIKit`__46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 87
frame #27: 0x028a1d86 CoreFoundation`__53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
frame #28: 0x028a1c5f CoreFoundation`-[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
frame #29: 0x00e1b115 UIKit`-[UIView(Geometry) resizeSubviewsWithOldSize:] + 149
frame #30: 0x00eadc1a UIKit`-[UITableView resizeSubviewsWithOldSize:] + 98
frame #31: 0x00e1c819 UIKit`-[UIView(Geometry) setBounds:] + 510
frame #32: 0x00e39627 UIKit`-[UIScrollView setBounds:] + 1036
frame #33: 0x00eadf5f UIKit`-[UITableView setBounds:] + 260
frame #34: 0x00e1befd UIKit`-[UIView(Geometry) _applyISEngineLayoutValues] + 324
frame #35: 0x00e1c4c0 UIKit`-[UIView(Geometry) _resizeWithOldSuperviewSize:] + 144
frame #36: 0x00e457bb UIKit`-[UIScrollView _resizeWithOldSuperviewSize:] + 73
frame #37: 0x00e1c5aa UIKit`-[UIView(Geometry) resizeWithOldSuperviewSize:] + 80
frame #38: 0x00e1b185 UIKit`__46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 87
frame #39: 0x028a1d86 CoreFoundation`__53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
frame #40: 0x028a1c5f CoreFoundation`-[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
frame #41: 0x00e1b115 UIKit`-[UIView(Geometry) resizeSubviewsWithOldSize:] + 149
frame #42: 0x0145961c UIKit`-[UIView(AdditionalLayoutSupport) _is_layout] + 158
frame #43: 0x00e20336 UIKit`-[UIView(Hierarchy) layoutSubviews] + 80
frame #44: 0x00e2d964 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
frame #45: 0x025b682b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #46: 0x01df345a QuartzCore`-[CALayer layoutSublayers] + 148
frame #47: 0x01de7244 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #48: 0x01de70b0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #49: 0x01d4d7fa QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
frame #50: 0x01d4eb85 QuartzCore`CA::Transaction::commit() + 393
frame #51: 0x01d4f258 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #52: 0x027ed36e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #53: 0x027ed2bf CoreFoundation`__CFRunLoopDoObservers + 399
frame #54: 0x027cb254 CoreFoundation`__CFRunLoopRun + 1076
frame #55: 0x027ca9d3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #56: 0x027ca7eb CoreFoundation`CFRunLoopRunInMode + 123
frame #57: 0x041895ee GraphicsServices`GSEventRunModal + 192
frame #58: 0x0418942b GraphicsServices`GSEventRun + 104
frame #59: 0x00dbef9b UIKit`UIApplicationMain + 1225

understanding 'lldb' backtace - app crashes when button is pressed

When I click on any button my app crashes. It throws a lldb run time error. I printed the backtrace:
* thread #1: tid = 0x2aaf3, 0x000000018db701c0 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 2.1
frame #0: 0x000000018db701c0 libobjc.A.dylib`objc_exception_throw
frame #1: 0x0000000181666bd4 CoreFoundation`-[NSException raise] + 12
frame #2: 0x0000000182124720 Foundation`-[NSObject(NSKeyValueCoding) setValue:forKey:] + 256
frame #3: 0x00000001815b25ec CoreFoundation`-[NSArray makeObjectsPerformSelector:] + 248
frame #4: 0x00000001849eadd0 UIKit`-[UINib instantiateWithOwner:options:] + 1232
frame #5: 0x000000018492f878 UIKit`-[UIViewController _loadViewFromNibNamed:bundle:] + 280
frame #6: 0x0000000184630488 UIKit`-[UIViewController loadViewIfRequired] + 88
frame #7: 0x00000001846303f4 UIKit`-[UIViewController view] + 32
frame #8: 0x00000001847dd868 UIKit`-[UINavigationController _startCustomTransition:] + 704
frame #9: 0x00000001846e7f54 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 464
frame #10: 0x00000001846e7d24 UIKit`-[UINavigationController __viewWillLayoutSubviews] + 56
frame #11: 0x00000001846e7ca4 UIKit`-[UILayoutContainerView layoutSubviews] + 200
frame #12: 0x000000018462aff8 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 348
frame #13: 0x000000018421c258 QuartzCore`-[CALayer layoutSublayers] + 184
frame #14: 0x0000000184216e20 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 300
frame #15: 0x0000000184216cd8 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
frame #16: 0x0000000184216560 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 280
frame #17: 0x0000000184216304 QuartzCore`CA::Transaction::commit() + 424
frame #18: 0x000000018420fc38 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
frame #19: 0x00000001816276a8 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
frame #20: 0x0000000181624930 CoreFoundation`__CFRunLoopDoObservers + 372
frame #21: 0x0000000181624cbc CoreFoundation`__CFRunLoopRun + 764
frame #22: 0x0000000181565c20 CoreFoundation`CFRunLoopRunSpecific + 452
frame #23: 0x000000018724dc0c GraphicsServices`GSEventRunModal + 168
frame #24: 0x0000000184696fdc UIKit`UIApplicationMain + 1156
* frame #25: 0x00000001001297a4 myapp`main(argc=1, argv=0x000000016fd33ca8) + 116 at main.m:16
frame #26: 0x000000018e163aa0 libdyld.dylib`start + 4
What does it mean?
This is your problem:
Foundation`-[NSObject(NSKeyValueCoding) setValue:forKey:]
because after this, is raised an Exception:
CoreFoundation`-[NSException raise] + 12
You are trying to set a value for a key in your object that could not exists or has some other problem.
P.S.: Update your answer with some relevant code so I can update my answer with more explanations.

UIResponder(Static) _setFirstResponder: break

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.

weird EXC_BAD_ACCESS in [UICollectionViewLayout dealloc]

I push a view controller that contains a UICollectionView onto a navigation controller. When I pop it to return to the previous VC, I get an EXC_BAD_ACCESS code=2. I have NSZombies enabled and it stops at the end (the line with the "}") of the dealloc method of my UICollectionViewLayout subclass. This is the stack trace:
* thread #1: tid = 0x70505, 0x030620b0 libobjc.A.dylib`objc_msgSend + 12, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=2, address=0x2)
frame #0: 0x030620b0 libobjc.A.dylib`objc_msgSend + 12
frame #1: 0x00f6812e UIKit`-[UICollectionViewLayout dealloc] + 226
frame #2: 0x000526ce MyDog`-[UICollectionViewWaterfallLayout dealloc](self=0x1da8e010, _cmd=0x03068678) + 206 at UICollectionViewWaterfallLayout.m:69
frame #3: 0x03063692 libobjc.A.dylib`objc_object::sidetable_release(bool) + 268
frame #4: 0x03064adf libobjc.A.dylib`-[NSObject release] + 25
frame #5: 0x00f87f50 UIKit`-[UICollectionViewData dealloc] + 45
frame #6: 0x03063692 libobjc.A.dylib`objc_object::sidetable_release(bool) + 268
frame #7: 0x03064adf libobjc.A.dylib`-[NSObject release] + 25
frame #8: 0x00f4a773 UIKit`-[UICollectionView dealloc] + 260
frame #9: 0x0098dd34 UIKit`-[UIView release] + 89
frame #10: 0x03062e97 libobjc.A.dylib`objc_release + 71
frame #11: 0x03062e3e libobjc.A.dylib`objc_storeStrong + 39
frame #12: 0x00040160 MyDog`-[MDProfileViewController dealloc](self=0x0dd1dd00, _cmd=0x03068678) + 96 at MDProfileViewController.m:83
frame #13: 0x00a4d275 UIKit`-[UIViewController release] + 89
frame #14: 0x03062e97 libobjc.A.dylib`objc_release + 71
frame #15: 0x009347bc UIKit`__destroy_helper_block_121 + 124
frame #16: 0x06d5e7a5 libsystem_sim_blocks.dylib`_Block_release + 207
frame #17: 0x009a1a4f UIKit`-[UIViewAnimationBlockDelegate dealloc] + 66
frame #18: 0x03063692 libobjc.A.dylib`objc_object::sidetable_release(bool) + 268
frame #19: 0x03064adf libobjc.A.dylib`-[NSObject release] + 25
frame #20: 0x039aede0 CoreFoundation`CFRelease + 272
frame #21: 0x03ab67ce CoreFoundation`-[__NSDictionaryI dealloc] + 126
frame #22: 0x03063692 libobjc.A.dylib`objc_object::sidetable_release(bool) + 268
frame #23: 0x03062e81 libobjc.A.dylib`objc_release + 49
frame #24: 0x03063ce7 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 537
frame #25: 0x039cea98 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #26: 0x039d37f3 CoreFoundation`__CFRunLoopRun + 1971
frame #27: 0x039d2bf3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #28: 0x039d2a0b CoreFoundation`CFRunLoopRunInMode + 123
frame #29: 0x03c87a27 GraphicsServices`GSEventRunModal + 192
frame #30: 0x03c8784e GraphicsServices`GSEventRun + 104
frame #31: 0x0093ff0b UIKit`UIApplicationMain + 1225
frame #32: 0x0001eecd MyDog`main(argc=1, argv=0xbfffeeb0) + 141 at main.m:11
I don't know how to debug this when the EXC_BAD_ACCESS is not directly caused by my code. Has anyone had such a problem? Thanks
UPDATE:
I also tried the "Zombies" Instruments preset but it just stopped without giving me any information.
Just ran into same problem. Your UICollectionView is still querying after you popped out the navigation controller. Add the following to the controller class which contains your UICollectionView
- (void)dealloc
{
_collectionView.dataSource = nil;
_collectionView.delegate = nil;
_collectionView = nil;
}
Try setting the .collectionViewLayout=nil in your dealloc method

Getting weird crash on changing device orientation twice

I am navigationcontroller view ,with toolbar,search bar & tableview.
On device orienatation change twice i see weird
*** -[UIImage isKindOfClass:]: message sent to deallocated instance 0x7a31c00
(lldb) bt
* thread #1: tid = 0x1f03, 0x93e06332 libsystem_kernel.dylib`__kill + 10, stop reason = signal SIGKILL
frame #0: 0x93e06332 libsystem_kernel.dylib`__kill + 10
frame #1: 0x93e05932 libsystem_kernel.dylib`kill$UNIX2003 + 32
frame #2: 0x01e10e03 CoreFoundation`___forwarding___ + 227
frame #3: 0x01e10cb2 CoreFoundation`_CF_forwarding_prep_0 + 50
frame #4: 0x00ae1a06 UIKit`-[UIImageView _setViewGeometry:forMetric:] + 295
frame #5: 0x00ae1c2d UIKit`-[UIImageView setFrame:] + 63
frame #6: 0x00a2b9f2 UIKit`-[UIView(Geometry) _resizeWithOldSuperviewSize:] + 838
frame #7: 0x00a2c08a UIKit`-[UIView(Geometry) resizeWithOldSuperviewSize:] + 72
frame #8: 0x00a2b3b5 UIKit`__46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke_0 + 73
frame #9: 0x01e41f1a CoreFoundation`__NSArrayChunkIterate + 362
frame #10: 0x01e0d635 CoreFoundation`__NSArrayEnumerate + 997
frame #11: 0x01e0d026 CoreFoundation`-[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
frame #12: 0x00a2b353 UIKit`-[UIView(Geometry) resizeSubviewsWithOldSize:] + 149
frame #13: 0x00a2a058 UIKit`-[UIView(Geometry) setFrame:] + 358
frame #14: 0x00abaf20 UIKit`-[UIViewControllerWrapperView setFrame:] + 193
frame #15: 0x00acfc13 UIKit`-[UINavigationController _layoutViewController:] + 335
frame #16: 0x00acf81c UIKit`-[UINavigationController _layoutTopViewController] + 155
frame #17: 0x00ad0899 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded] + 346
frame #18: 0x00ad09e1 UIKit`-[UINavigationController __viewWillLayoutSubviews] + 33
frame #19: 0x00bee5c2 UIKit`-[UILayoutContainerView layoutSubviews] + 222
frame #20: 0x00a34d21 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 145
frame #21: 0x01eabe42 CoreFoundation`-[NSObject performSelector:withObject:] + 66
frame #22: 0x0304e679 QuartzCore`-[CALayer layoutSublayers] + 266
frame #23: 0x03058579 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 231
frame #24: 0x0304e740 QuartzCore`-[CALayer layoutIfNeeded] + 184
frame #25: 0x00a2e938 UIKit`-[UIView(Hierarchy) layoutIfNeeded] + 42
frame #26: 0x00ac898a UIKit`-[UIViewController window:willAnimateRotationToInterfaceOrientation:duration:] + 565
frame #27: 0x00a21ef9 UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 4712
frame #28: 0x00a20c8c UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
frame #29: 0x00a20b97 UIKit`-[UIWindow _setRotatableViewOrientation:duration:force:] + 93
frame #30: 0x00a2017b UIKit`-[UIWindow _updateToInterfaceOrientation:duration:force:] + 228
frame #31: 0x00a202ac UIKit`-[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 162
frame #32: 0x00a20203 UIKit`-[UIWindow _updateInterfaceOrientationFromDeviceOrientationIfRotationEnabled:] + 82
frame #33: 0x00a20028 UIKit`-[UIWindow _handleDeviceOrientationChange:] + 121
frame #34: 0x013b8a29 Foundation`__57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 40
frame #35: 0x01e75855 CoreFoundation`___CFXNotificationPost_block_invoke_0 + 85
frame #36: 0x01e75778 CoreFoundation`_CFXNotificationPost + 1976
frame #37: 0x012fd19a Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 98
frame #38: 0x00bccdb1 UIKit`-[UIDevice setOrientation:animated:] + 220
frame #39: 0x00a042fd UIKit`-[UIApplication handleEvent:withNewEvent:] + 1405
frame #40: 0x00a04c38 UIKit`-[UIApplication sendEvent:] + 68
frame #41: 0x009f8634 UIKit`_UIApplicationHandleEvent + 8196
frame #42: 0x01cadef5 GraphicsServices`PurpleEventCallback + 1274
frame #43: 0x01e7e195 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #44: 0x01de2ff2 CoreFoundation`__CFRunLoopDoSource1 + 146
frame #45: 0x01de18da CoreFoundation`__CFRunLoopRun + 2218
frame #46: 0x01de0d84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #47: 0x01de0c9b CoreFoundation`CFRunLoopRunInMode + 123
frame #48: 0x01cac7d8 GraphicsServices`GSEventRunModal + 190
frame #49: 0x01cac88a GraphicsServices`GSEventRun + 103
frame #50: 0x009f6626 UIKit`UIApplicationMain + 1163
I dont have any code inside delegate
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
shouldAutorotateToInterfaceOrientation supports all orientation
I could find cause of crash
I overide UItoolbar class to create custom toolbar with image in background.which cause crash on orientation change
#interface CustomWhiteToolbar : UIToolbar {
}
#end
#implementation CustomWhiteToolbar
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
UIImage *img = [UIImage imageNamed: #"White_bordered_background.png"];
[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[img release];
self.tintColor = [UIColor clearColor];
}
#end
this cause crash on orientation changes.I have custom toolbar class set to toolbar inside my xib.I couldnt find why did that crash

Resources