Strange UIAlertController / UICollectionViewFlowLayout issue
Strange UIAlertController / UICollectionViewFlowLayout issue
- Subject: Strange UIAlertController / UICollectionViewFlowLayout issue
- From: email@hidden
- Date: Sat, 09 Jan 2016 23:35:40 +0100
- Importance: Normal
Hi list,
I am getting strange feedback in the debugger when presenting a
UIAlertController on iPhone 6 Plus (iOS9.1 device and iOS 9.2 simulator)
and iPad Pro (iOS 9.2 simulator):
"the behavior of the UICollectionViewFlowLayout is not defined because:
the item height must be less than the height of the UICollectionView minus
the section insets top and bottom values, minus the content insets top and
bottom values.
The relevant UICollectionViewFlowLayout instance is
<_UIAlertControllerCollectionViewFlowLayout: 0x7fb8d5990790>, and it is
attached to <UICollectionView: 0x7fb8d3a96800; frame = (0 123.667; 270
44); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fb8d5991420>;
layer = <CALayer: 0x7fb8d5990d30>; contentOffset: {0, 0}; contentSize: {0,
0}> collection view layout: <_UIAlertControllerCollectionViewFlowLayout:
0x7fb8d5990790>.
Make a symbolic breakpoint at
UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the
debugger."
After setting the mentioned symbolic breakpoint and re-running the app,
and subsequently typing 'bt' in the debugger, I am getting this stack
trace:
* thread #1: tid = 0xd3616a, 0x000000010f377ca8
UIKit`UICollectionViewFlowLayoutBreakForInvalidSizes, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x000000010f377ca8
UIKit`UICollectionViewFlowLayoutBreakForInvalidSizes
frame #1: 0x000000010f37af15 UIKit`-[_UIFlowLayoutSection
logInvalidSizesForHorizontalDirection:warnAboutDelegateValues:] + 219
frame #2: 0x000000010f3791d0 UIKit`-[_UIFlowLayoutSection
computeLayout] + 951
frame #3: 0x000000010f3273d0 UIKit`__56-[UICollectionViewFlowLayout
_updateItemsLayoutForRect:]_block_invoke + 107
frame #4: 0x0000000110b06462 CoreFoundation`__53-[__NSArrayM
enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
frame #5: 0x0000000110b05b52 CoreFoundation`-[__NSArrayM
enumerateObjectsWithOptions:usingBlock:] + 194
frame #6: 0x000000010f327293 UIKit`-[UICollectionViewFlowLayout
_updateItemsLayoutForRect:] + 575
frame #7: 0x000000010f327726 UIKit`-[UICollectionViewFlowLayout
_fetchItemsInfoForRect:] + 175
frame #8: 0x000000010f320efd UIKit`-[UICollectionViewFlowLayout
prepareLayout] + 273
frame #9: 0x000000010f3416e5 UIKit`-[UICollectionViewData
_prepareToLoadData] + 67
frame #10: 0x000000010f341e6e UIKit`-[UICollectionViewData
validateLayoutInRect:] + 53
frame #11: 0x000000010f2f1208 UIKit`-[UICollectionView layoutSubviews]
+ 196
frame #12: 0x000000010eb4c4a3 UIKit`-[UIView(CALayerDelegate)
layoutSublayersOfLayer:] + 703
frame #13: 0x000000011107759a QuartzCore`-[CALayer layoutSublayers] + 146
frame #14: 0x000000011106be70
QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 366
frame #15: 0x000000010eb3bd0d UIKit`-[UIView(Hierarchy)
layoutBelowIfNeeded] + 1129
frame #16: 0x000000010ed9b70f
UIKit`-[_UIAlertControllerPresentationController
_prepareConstraintsIfNecessary] + 727
frame #17: 0x000000010ed9b2b6
UIKit`-[_UIAlertControllerPresentationController
presentationTransitionWillBegin] + 351
frame #18: 0x000000010ec018dc UIKit`__71-[UIPresentationController
_initViewHierarchyForPresentationSuperview:]_block_invoke + 2035
frame #19: 0x000000010ebff50e UIKit`__56-[UIPresentationController
runTransitionForCurrentState]_block_invoke + 309
frame #20: 0x000000010eaa14a2 UIKit`_runAfterCACommitDeferredBlocks + 317
frame #21: 0x000000010eab4c01
UIKit`_cleanUpAfterCAFlushAndRunDeferredBlocks + 95
frame #22: 0x000000010eac0af3 UIKit`_afterCACommitHandler + 90
frame #23: 0x0000000110b03367
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
+ 23
frame #24: 0x0000000110b032d7 CoreFoundation`__CFRunLoopDoObservers + 391
frame #25: 0x0000000110af8f2b CoreFoundation`__CFRunLoopRun + 1147
frame #26: 0x0000000110af8828 CoreFoundation`CFRunLoopRunSpecific + 488
frame #27: 0x0000000112c0ead2 GraphicsServices`GSEventRunModal + 161
frame #28: 0x000000010ea95610 UIKit`UIApplicationMain + 171
frame #29: 0x000000010e73712f WetboekVanStrafrechtCA`main(argc=1,
argv=0x00007fff514ca528) + 111 at main.m:16
frame #30: 0x000000011657a92d libdyld.dylib`start + 1
frame #31: 0x000000011657a92d libdyld.dylib`start + 1
HERE IS THE CODE INVOLVED:
func showSearchDialog() {
let alertcontroller = UIAlertController(title: "Search", message:
"Search this document", preferredStyle: .Alert)
alertcontroller.addTextFieldWithConfigurationHandler({(input:UITextField)in
input.placeholder="Type your searchword here";
input.clearButtonMode=UITextFieldViewMode.WhileEditing;
});
alertcontroller.addAction(UIAlertAction(title: "Cancel", style:
UIAlertActionStyle.Cancel, handler: nil));
alertcontroller.addAction(UIAlertAction(title: "Search", style:
UIAlertActionStyle.Default, handler: {(action:UIAlertAction) in
if let fields = alertcontroller.textFields {
let textfield = fields[0]
if let needle = textfield.text {
self.performSearch(needle)
}
}
}));
presentViewController(alertcontroller, animated: true, completion:
nil)
}
THE ALERT GETS SHOWN, BUT IS HALF THE TIME SLOW TO APPEAR ON SCREEN...
I DON'T HAVE THIS ISSUE WHEN RUNNING THE APP ON THE iPHONE 6 OR iPAD AIR 2
SIMULATORS.
HOWEVER, ON THE iPAD PRO SIMULATOR I AM SEEING THIS IN THE DEBUGGER:
<Error>: CGContextConcatCTM: invalid context 0x0. Backtrace:
<-[UIKBRenderer renderKeyContents:withTraits:]+102>
<-[UIKBKeyplaneView drawContentsOfRenderers:]+1198>
<-[UIKeyboardCache displayImagesForView:fromLayout:imageFlags:]+1518>
<-[UIKBKeyplaneView displayLayer:]+448>
<_ZN2CA5Layer7displayEv+140>
<_ZN2CA5Layer17display_if_neededEPNS_11TransactionE+293>
<_ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE+35>
<_ZN2CA7Context18commit_transactionEPNS_11TransactionE+277>
<_ZN2CA11Transaction6commitEv+486>
<_afterCACommitHandler+174>
<__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__+23>
<__CFRunLoopDoObservers+391>
<__CFRunLoopRun+1147>
<CFRunLoopRunSpecific+488>
<GSEventRunModal+161>
<UIApplicationMain+171>
<main+111>
<start+1>
<Error>: CGBitmapContextCreateImage: invalid context 0x0. Backtrace:
<__52-[UIKBRenderer
renderBackgroundTraits:allowCaching:]_block_invoke_2+38>
<-[UIKBRenderer _completeCacheImageWithTraitsIfNecessary:]+50>
<-[UIKBRenderer renderKeyContents:withTraits:]+317>
<-[UIKBKeyplaneView drawContentsOfRenderers:]+1198>
<-[UIKeyboardCache displayImagesForView:fromLayout:imageFlags:]+1518>
<-[UIKBKeyplaneView displayLayer:]+448>
<_ZN2CA5Layer7displayEv+140>
<_ZN2CA5Layer17display_if_neededEPNS_11TransactionE+293>
<_ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE+35>
<_ZN2CA7Context18commit_transactionEPNS_11TransactionE+277>
<_ZN2CA11Transaction6commitEv+486>
<_afterCACommitHandler+174>
<__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__+23>
<__CFRunLoopDoObservers+391>
<__CFRunLoopRun+1147>
<CFRunLoopRunSpecific+488>
<GSEventRunModal+161>
<UIApplicationMain+171>
<main+111>
<start+1>
<Error>: CGContextConcatCTM: invalid context 0x0. Backtrace:
<-[UIKBRenderer renderKeyContents:withTraits:]+102>
<-[UIKBKeyplaneView drawContentsOfRenderers:]+1198>
<-[UIKeyboardCache displayImagesForView:fromLayout:imageFlags:]+1518>
<-[UIKBKeyplaneView displayLayer:]+448>
<_ZN2CA5Layer7displayEv+140>
<_ZN2CA5Layer17display_if_neededEPNS_11TransactionE+293>
<_ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE+35>
<_ZN2CA7Context18commit_transactionEPNS_11TransactionE+277>
<_ZN2CA11Transaction6commitEv+486>
<_afterCACommitHandler+174>
<__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__+23>
<__CFRunLoopDoObservers+391>
<__CFRunLoopRun+1147>
<CFRunLoopRunSpecific+488>
<GSEventRunModal+161>
<UIApplicationMain+171>
<main+111>
<start+1>
<Error>: CGBitmapContextCreateImage: invalid context 0x0. Backtrace:
<__52-[UIKBRenderer
renderBackgroundTraits:allowCaching:]_block_invoke_2+38>
<-[UIKBRenderer _completeCacheImageWithTraitsIfNecessary:]+50>
<-[UIKBRenderer renderBackgroundTraits:allowCaching:]+2870>
<-[UIKBRenderer renderKeyContents:withTraits:]+102>
<-[UIKBKeyplaneView drawContentsOfRenderers:]+1198>
<-[UIKeyboardCache displayImagesForView:fromLayout:imageFlags:]+1518>
<-[UIKBKeyplaneView displayLayer:]+448>
<_ZN2CA5Layer7displayEv+140>
<_ZN2CA5Layer17display_if_neededEPNS_11TransactionE+293>
<_ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE+35>
<_ZN2CA7Context18commit_transactionEPNS_11TransactionE+277>
<_ZN2CA11Transaction6commitEv+486>
<_afterCACommitHandler+174>
<__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__+23>
<__CFRunLoopDoObservers+391>
<__CFRunLoopRun+1147>
<CFRunLoopRunSpecific+488>
<GSEventRunModal+161>
<UIApplicationMain+171>
<main+111>
<start+1>
HAS ANYBODY RUN INTO THIS? AND/OR CAN ANYBODY TELL ME WHETHER THIS IS BAD
AND HOW I CAN GET THE ALERT TO APPEAR CONSISTENTLY FAST ON SCREEN??
MANY THANKS,
DIEDERIK
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden