I am trying to implement a search bar in a UICollectionView as a UICollectionViewReusableView
This way I am not using a UISearchController but I am changing the datasource of the collectionview
In my custom layout I am adding the searchbar this way:
override func prepareLayout() {
super.prepareLayout()
var searchBarAttributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: TeacherSearchbarIdentifier, withIndexPath: NSIndexPath(forItem: 0, inSection: 0))
searchBarAttributes.frame = CGRectMake(0, 0, collectionViewContentSize().width, 44)
searchBarAttributes.zIndex = 100
miscAttributes.append(searchBarAttributes)
}
override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? {
var attributes = [UICollectionViewLayoutAttributes]()
for (idx, attr) in enumerate(miscAttributes) {
if CGRectIntersection(rect, attr.frame) != CGRectNull {
attributes.append(attr)
}
}
return attributes
}
I am setting the delegate like this:
func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
var view = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: kind, forIndexPath: indexPath) as! UICollectionReusableView
if kind == TeacherSearchbarIdentifier {
controller.searchBar = (view as! TeacherSearchView).searchBar
return view
}
}
The variable controller is the UICollectionViewController which implements the UISearchBarDelegate Protocol
The delegate is set in didSet of the searchBar variable. These are my delegates:
override func scrollViewDidScroll(scrollView: UIScrollView) {
self.view.endEditing(true)
}
func searchBarShouldBeginEditing(searchBar: UISearchBar) -> Bool {
searchBar.setShowsCancelButton(true, animated: true)
return true
}
func searchBarShouldEndEditing(searchBar: UISearchBar) -> Bool {
searchBar.setShowsCancelButton(false, animated: true)
searchBar.resignFirstResponder()
return true
}
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
searchBar.setShowsCancelButton(false, animated: true)
searchBar.resignFirstResponder()
}
Now my problem!
When I am tapping on the search bar, the keyboard appears. If I press the cancel button or scroll, it dissappears. Just as I want it to. This also works a second time.
BUT!
If I do this a third time, I get a EXC_BAD_ACCESS:
I tried turning on Enabling Zombie Objects, but no information was provided.
I also tried profiling for Zombie Objects, it just crashes without any noticeable information.
Please help me on how I can resolve this error, or give me further debugging instructions.
EDIT 1:
Here is the output from bt all in the lldb debugger:
* thread #1: tid = 0x228fc, 0x000000019502fbd0 libobjc.A.dylib`objc_msgSend + 16, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1cda8beb8)
frame #0: 0x000000019502fbd0 libobjc.A.dylib`objc_msgSend + 16
frame #1: 0x000000018328b2f4 CoreFoundation`-[__NSDictionaryM objectForKey:] + 84
frame #2: 0x00000001884a21b8 UIKit`-[UICollectionView _visibleViewDictForElementCategory:elementKind:] + 96
frame #3: 0x0000000187ff6644 UIKit`-[UICollectionView _indexPathForView:ofType:] + 160
frame #4: 0x000000018849c3dc UIKit`-[UICollectionView _setIsAncestorOfFirstResponder:] + 792
frame #5: 0x0000000187ed9418 UIKit`+[UIView(Internal) _setIsResponderAncestorOfFirstResponder:startingAtFirstResponder:] + 164
frame #6: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #7: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #8: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #9: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #10: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #11: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #12: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #13: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #14: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #15: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #16: 0x0000000187ed925c UIKit`-[UIResponder(Static) _setFirstResponder:] + 56
frame #17: 0x0000000187f1b194 UIKit`-[UITextField _becomeFirstResponder] + 60
frame #18: 0x000000018800f300 UIKit`-[UISearchBarTextField _becomeFirstResponder] + 108
frame #19: 0x0000000187e9ad28 UIKit`-[UIResponder becomeFirstResponder] + 392
frame #20: 0x0000000187e9b0ac UIKit`-[UIView(Hierarchy) becomeFirstResponder] + 124
frame #21: 0x0000000187f19de4 UIKit`-[UITextField becomeFirstResponder] + 68
frame #22: 0x0000000187fc9fc4 UIKit`-[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 200
frame #23: 0x0000000187fc962c UIKit`-[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:] + 1736
frame #24: 0x0000000187faf070 UIKit`_UIGestureRecognizerSendActions + 276
frame #25: 0x0000000187e486b4 UIKit`-[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 580
frame #26: 0x00000001882b938c UIKit`___UIGestureRecognizerUpdate_block_invoke662 + 60
frame #27: 0x0000000187e0c418 UIKit`_UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 292
frame #28: 0x0000000187e0a7c4 UIKit`_UIGestureRecognizerUpdate + 2504
frame #29: 0x0000000187e4682c UIKit`-[UIWindow _sendGesturesForEvent:] + 1044
frame #30: 0x0000000187e45ee4 UIKit`-[UIWindow sendEvent:] + 660
frame #31: 0x0000000187e19120 UIKit`-[UIApplication sendEvent:] + 264
frame #32: 0x00000001880ba2b8 UIKit`_UIApplicationHandleEventFromQueueEvent + 15424
frame #33: 0x0000000187e17634 UIKit`_UIApplicationHandleEventQueue + 1716
frame #34: 0x0000000183358240 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #35: 0x00000001833574e4 CoreFoundation`__CFRunLoopDoSources0 + 264
frame #36: 0x0000000183355594 CoreFoundation`__CFRunLoopRun + 712
frame #37: 0x00000001832812d4 CoreFoundation`CFRunLoopRunSpecific + 396
frame #38: 0x000000018ccdf6fc GraphicsServices`GSEventRunModal + 168
frame #39: 0x0000000187e7ef40 UIKit`UIApplicationMain + 1488
* frame #40: 0x00000001000f0798 My-Project`main + 164 at AppDelegate.swift:14
frame #41: 0x00000001956c6a08 libdyld.dylib`start + 4
thread #2: tid = 0x22939, 0x00000001957c4c24 libsystem_kernel.dylib`kevent64 + 8, queue = 'com.apple.libdispatch-manager'
frame #0: 0x00000001957c4c24 libsystem_kernel.dylib`kevent64 + 8
frame #1: 0x000000010083a588 libdispatch.dylib`_dispatch_mgr_invoke + 276
frame #2: 0x000000010082b09c libdispatch.dylib`_dispatch_mgr_thread + 52
thread #8: tid = 0x229d9, 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x00000001958792dc libsystem_pthread.dylib`_pthread_wqthread + 992
thread #7: tid = 0x229da, 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x00000001958792dc libsystem_pthread.dylib`_pthread_wqthread + 992
thread #9: tid = 0x229df, 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x00000001958792dc libsystem_pthread.dylib`_pthread_wqthread + 992
thread #10: tid = 0x229e1, 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x00000001958792dc libsystem_pthread.dylib`_pthread_wqthread + 992
thread #11: tid = 0x229e2, 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x00000001957dfc78 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x00000001958792dc libsystem_pthread.dylib`_pthread_wqthread + 992
thread #12: tid = 0x229e3, 0x00000001957c4e0c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.NSURLConnectionLoader'
frame #0: 0x00000001957c4e0c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x00000001957c4c88 libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000183357724 CoreFoundation`__CFRunLoopServiceMachPort + 200
frame #3: 0x0000000183355678 CoreFoundation`__CFRunLoopRun + 940
frame #4: 0x00000001832812d4 CoreFoundation`CFRunLoopRunSpecific + 396
frame #5: 0x0000000182d5e594 CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 440
frame #6: 0x00000001842a1db8 Foundation`__NSThread__main__ + 1072
frame #7: 0x000000019587bdc8 libsystem_pthread.dylib`_pthread_body + 164
frame #8: 0x000000019587bd24 libsystem_pthread.dylib`_pthread_start + 160
thread #13: tid = 0x229e6, 0x00000001957df498 libsystem_kernel.dylib`__select + 8, name = 'com.apple.CFSocket.private'
frame #0: 0x00000001957df498 libsystem_kernel.dylib`__select + 8
frame #1: 0x000000018335d128 CoreFoundation`__CFSocketManager + 672
frame #2: 0x000000019587bdc8 libsystem_pthread.dylib`_pthread_body + 164
frame #3: 0x000000019587bd24 libsystem_pthread.dylib`_pthread_start + 160
EDIT 2:
I created a standalone project which produces this error. Just run the project and tap/cancel the searchbar a few times.
Download Project
Video:
Bugreport: rdar://problem/21673802
I came up with a workaround for this in iOS 8. I discovered that the crash only occurred if the kind string of my supplementary view was a Swift string. There was no crash when I used an Objective-C string bridged to Swift. I tried the obvious idea of creating a NSString explicitly in Swift and even tried creating a CFString in Swift and bridging that. However, neither of those efforts were successful.
To easily verify this, try changing TeacherSearchbarIdentifier to an Objective-C string from UIKit like UICollectionElementKindSectionHeader.
A more rigorous workaround would involve creating Objective-C strings for your use case and exposing those to Swift. As an example:
// MyElementKinds.h
#import Foundation;
FOUNDATION_EXPORT NSString *const TeacherSearchbarIdentifier;
// MyElementKinds.m
#import "MyElementKinds.h"
NSString *const TeacherSearchbarIdentifier = #"TeacherSearchbarIdentifier";
I committed a bug report to apple, and they said this:
Apple Developer Relations
Thanks for the update. Upgrading is the solution then.
We are closing this bug report.
If you have questions regarding the resolution of this issue, please
update your bug report with that information.
Please be sure to regularly check new Apple releases for any updates
that might affect this issue.
Basically they don't care about this issue right now because of their upcoming release of iOS 9
I asked what the correct way is to keep compatibility to iOS 8 and the bug report is still open. Let's wait and see!
Related
I have a very simple Xcode UI Test with this function:
func waitForElementToAppear(_ element: XCUIElement) -> Bool {
let predicate = NSPredicate(format: "exists == true")
let exp = expectation(for: predicate, evaluatedWith: element, handler: nil)
let result = XCTWaiter().wait(for: [exp], timeout: 10)
return result == .completed
}
Which has always worked for me before Xcode 9. I am not sure if this is an Xcode 10 issue, but it has recently started without me adding or changing any code.
Here is my test code:
func testTabBarPress() {
let tabbar = self.app.tabBars["my_tabbar"]
print(tabbar)
}
This test succeeds - always.
func testTabBarPress() {
let tabbar = self.app.tabBars["my_tabbar"]
print(tabbar)
if tabbar.isHittable {
}
}
This test fails - always. It does not JUST fail, it crashes with Thread 1: EXC_BAD_ACCESS (code=1, address=0x0).
After more than 99.945 seconds it switches from crashed state to failed test state with the message: Timeout waiting for fulfillment of promise for 'remote query'..
This test:
func testTabBarPress() {
let tabbar = self.app.tabBars["my_tabbar"]
print(tabbar)
if waitForElementToAppear(tabbar) {
}
}
Crashes with the same message of EXC_BAD_ACCESS but it does succeed afterwards.
I also did reset the simulators, cleaned the build folder and updated Xcode to 10.2.1 (10E1001)
At the top of my test I define my app:
private var app: XCUIApplication = XCUIApplication() and in setup() I launch it.
Any help appreciated. Thanks!
Edit:
Here is the stack trace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000113a833d0 libsystem_platform.dylib`_platform_strcmp + 80
frame #1: 0x00000001322086f1 UIKit`-[UIViewAccessibility _accessibilityRetrieveIvarText] + 364
frame #2: 0x00000001321f5e54 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewIvarsText] + 118
frame #3: 0x00000001321f6b27 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText:] + 2749
frame #4: 0x00000001321f99c1 UIKit`-[UITableViewCellAccessibility accessibilityLabel] + 123
frame #5: 0x000000012ee47739 PreferencesFramework`-[UITableViewCellAccessibility__Preferences__UIKit accessibilityLabel] + 327
frame #6: 0x000000013243f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #7: 0x000000013243f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #8: 0x00000001321d620e UIKit`-[UINavigationBarAccessibility_UIViewAccessibilityAdditions _accessibilityAXAttributedLabel] + 650
frame #9: 0x000000013220b711 UIKit`-[UITableViewCellAccessibilityElement accessibilityLabel] + 48
frame #10: 0x000000013243f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #11: 0x000000013243f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #12: 0x000000013243e9ae UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityProcessedLabelAttribute] + 34
frame #13: 0x0000000132442c32 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 268
frame #14: 0x000000013246cacd UIAccessibility`_accessibilityAttributesForObject + 493
frame #15: 0x000000013246c43a UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1239
frame #16: 0x000000013246dfd9 UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 1139
frame #17: 0x0000000132441f09 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 8537
frame #18: 0x00000001321cb100 UIKit`-[UIApplicationAccessibility accessibilityAttributeValue:forParameter:] + 290
frame #19: 0x0000000132424657 UIAccessibility`_copyParameterizedAttributeValueCallback + 434
frame #20: 0x0000000130ef1629 AXRuntime`___AXXMIGCopyParameterizedAttributeValue_block_invoke + 50
frame #21: 0x0000000130ef0f99 AXRuntime`_handleNonMainThreadCallback + 55
frame #22: 0x0000000130ef14cb AXRuntime`_AXXMIGCopyParameterizedAttributeValue + 285
frame #23: 0x0000000130eec976 AXRuntime`AXUIElementCopyParameterizedAttributeValue + 495
frame #24: 0x0000000130e80351 XCTAutomationSupport`-[XCTAccessibilityFramework userTestingSnapshotForElement:options:error:] + 420
frame #25: 0x0000000130e77e90 XCTAutomationSupport`-[XCTElementSnapshotRequest(PlatformImplementation) accessibilitySnapshotOrError:] + 1263
frame #26: 0x0000000130e8305f XCTAutomationSupport`__56-[XCTElementSnapshotRequest loadSnapshotAndReturnError:]_block_invoke_2 + 64
frame #27: 0x0000000130e728dd XCTAutomationSupport`__XCTPerformOnMainRunLoop_block_invoke + 295
frame #28: 0x0000000111251aec CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #29: 0x00000001112512b0 CoreFoundation`__CFRunLoopDoBlocks + 336
frame #30: 0x000000011124c10b CoreFoundation`__CFRunLoopRun + 2747
frame #31: 0x000000011124b302 CoreFoundation`CFRunLoopRunSpecific + 626
frame #32: 0x000000011748d2fe GraphicsServices`GSEventRunModal + 65
frame #33: 0x0000000119ea2ba2 UIKitCore`UIApplicationMain + 140
* frame #34: 0x000000010d2afa4b Musify`main at AppDelegate.swift:20:7
frame #35: 0x0000000113721541 libdyld.dylib`start + 1
frame #36: 0x0000000113721541 libdyld.dylib`start + 1
And here is a trace for a recording crash:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000107c223d0 libsystem_platform.dylib`_platform_strcmp + 80
frame #1: 0x00000001269186f1 UIKit`-[UIViewAccessibility _accessibilityRetrieveIvarText] + 364
frame #2: 0x0000000126905e54 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewIvarsText] + 118
frame #3: 0x0000000126906b27 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText:] + 2749
frame #4: 0x00000001269099c1 UIKit`-[UITableViewCellAccessibility accessibilityLabel] + 123
frame #5: 0x0000000123633739 PreferencesFramework`-[UITableViewCellAccessibility__Preferences__UIKit accessibilityLabel] + 327
frame #6: 0x0000000126b4f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #7: 0x0000000126b4f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #8: 0x00000001268e620e UIKit`-[UINavigationBarAccessibility_UIViewAccessibilityAdditions _accessibilityAXAttributedLabel] + 650
frame #9: 0x000000012691b711 UIKit`-[UITableViewCellAccessibilityElement accessibilityLabel] + 48
frame #10: 0x0000000126b4f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #11: 0x0000000126b4f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #12: 0x0000000126b4e9ae UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityProcessedLabelAttribute] + 34
frame #13: 0x0000000126b52c32 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 268
frame #14: 0x0000000126b7cacd UIAccessibility`_accessibilityAttributesForObject + 493
frame #15: 0x0000000126b7c43a UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1239
frame #16: 0x0000000126b7dfd9 UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 1139
frame #17: 0x0000000126b51f09 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 8537
frame #18: 0x00000001268db100 UIKit`-[UIApplicationAccessibility accessibilityAttributeValue:forParameter:] + 290
frame #19: 0x0000000126b34657 UIAccessibility`_copyParameterizedAttributeValueCallback + 434
frame #20: 0x00000001260bf629 AXRuntime`___AXXMIGCopyParameterizedAttributeValue_block_invoke + 50
frame #21: 0x00000001260bef99 AXRuntime`_handleNonMainThreadCallback + 55
frame #22: 0x00000001260bf4cb AXRuntime`_AXXMIGCopyParameterizedAttributeValue + 285
frame #23: 0x00000001260b94f0 AXRuntime`_XCopyParameterizedAttributeValue + 414
frame #24: 0x00000001260ce1b7 AXRuntime`mshMIGPerform + 237
frame #25: 0x00000001053ea419 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
frame #26: 0x00000001053e9a7b CoreFoundation`__CFRunLoopDoSource1 + 459
frame #27: 0x00000001053e400a CoreFoundation`__CFRunLoopRun + 2490
frame #28: 0x00000001053e3302 CoreFoundation`CFRunLoopRunSpecific + 626
frame #29: 0x000000010b62c2fe GraphicsServices`GSEventRunModal + 65
frame #30: 0x000000010e822ba2 UIKitCore`UIApplicationMain + 140
* frame #31: 0x00000001013dea4b Musify`main at AppDelegate.swift:20:7
frame #32: 0x00000001078c0541 libdyld.dylib`start + 1
frame #33: 0x00000001078c0541 libdyld.dylib`start + 1
By the way, recording and tapping on elements also crashes.
EDIT 2:
I figured out that using the Accessibility Identifier the App also crashes.. So I just need to hover over the Simulator to make the app crash. I am out of ideas :(
I am moving across some content across from a different application, and doing so required me to move a NIB. Moving this NIB has caused a crash on iOS 10 which was occurring every time - this crash had no search results on stack overflow or much other information online.
I am reloading the cell using this code:
collectionView?.performBatchUpdates({
collectionView?.insertItems(at: [ indexPath ])
}, completion: nil)
Specifically, when inserting the collection view cell, this is the error:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x0000000105015acb libobjc.A.dylib`objc_msgSend + 11
frame #1: 0x0000000104c5506f Foundation`-[NSLayoutAnchor nsli_lowerIntoExpression:withCoefficient:forConstraint:] + 376
frame #2: 0x0000000104b21c11 Foundation`-[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 99
frame #3: 0x0000000104b1b56e Foundation`-[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 121
frame #4: 0x000000010721fc71 UIKit`__57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 454
frame #5: 0x0000000104b2182b Foundation`-[NSISEngine withBehaviors:performModifications:] + 155
frame #6: 0x000000010721fa84 UIKit`__57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 604
frame #7: 0x000000010721f800 UIKit`-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 223
frame #8: 0x000000010721e933 UIKit`-[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 447
frame #9: 0x0000000107211499 UIKit`-[UIView(UIConstraintBasedLayout) _layoutEngine_windowDidChange] + 130
frame #10: 0x0000000106917909 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 209
frame #11: 0x000000010690ab96 UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
frame #12: 0x000000010690aa7d UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 828
frame #13: 0x000000010691aa0a UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1927
frame #14: 0x000000010718aef7 UIKit`-[UICollectionView _addControlledSubview:atZIndex:] + 571
frame #15: 0x000000010718dec0 UIKit`-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1881
frame #16: 0x000000010718d761 UIKit`-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 35
frame #17: 0x00000001071ac194 UIKit`__51-[UICollectionView _viewAnimationsForCurrentUpdate]_block_invoke.1941 + 564
frame #18: 0x00000001071a95bb UIKit`-[UICollectionView _viewAnimationsForCurrentUpdate] + 5141
frame #19: 0x00000001071aebf3 UIKit`__71-[UICollectionView _updateWithItems:tentativelyForReordering:animator:]_block_invoke.2012 + 197
frame #20: 0x000000010691308e UIKit`+[UIView(Animation) performWithoutAnimation:] + 90
frame #21: 0x00000001071ad82d UIKit`-[UICollectionView _updateWithItems:tentativelyForReordering:animator:] + 3856
frame #22: 0x00000001071a7b33 UIKit`-[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 17030
frame #23: 0x00000001071b01cd UIKit`-[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
frame #24: 0x00000001071b0514 UIKit`-[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 437
frame #25: 0x00000001071b033c UIKit`-[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
frame #26: 0x00000001071b02be UIKit`-[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
frame #27: 0x00000001071b0213 UIKit`-[UICollectionView performBatchUpdates:completion:] + 53
* frame #28: 0x00000001046f44be IndexListSampleApp`closure #1 in RemoteIndexListContent.willDisplay(result=success, self=0x00006080000d0fb0, collectionView=0x00007f924588e600, indexPath=2 indices) at RemoteIndexListContent.swift:98
frame #29: 0x00000001046f464d IndexListSampleApp`partial apply for closure #1 in RemoteIndexListContent.willDisplay(itemAtIndexPath:cell:collectionView:) at RemoteIndexListContent.swift:0
frame #30: 0x000000010458f528 IndexListSampleApp`specialized closure #1 in RemoteLiveEventTileContentProvider.loadContent(fixtures=<unavailable>, self=<unavailable>, completion=0x00000001046f45d0 IndexListSampleApp`partial apply forwarder for closure #1 (Result.Result<IndexListFoundation.IndexListContent>) -> () in IndexListFoundation.RemoteIndexListContent.willDisplay(itemAtIndexPath: Foundation.IndexPath, cell: __ObjC.UICollectionViewCell, collectionView: __ObjC.UICollectionView) -> () at RemoteIndexListContent.swift) at RemoteLiveEventTileContentProvider.swift:49 [opt]
frame #31: 0x000000010458cc0b IndexListSampleApp`partial apply for closure #1 in RemoteLiveEventTileContentProvider.loadContent(completion:) [inlined] closure #1 (Swift.Optional<Swift.Array<Core.Fixture>>, Swift.Optional<Swift.Error>) -> () in LiveEvent.RemoteLiveEventTileContentProvider.loadContent(completion: (Result.Result<IndexListFoundation.IndexListContent>) -> ()) -> () at RemoteLiveEventTileContentProvider.swift:0 [opt]
This only happens on iOS 10.2.1 -> 10.3.1 - OK on iOS 9 and iOS 11. I am using Xcode 9.0.1, the crash is also reproducible on Xcode 9.2.
The fix was quite simple. I had "Use Safe Area Layout Guides" ticked - this clearly has an underlying issue on iOS 10.2.1 -> 10.3.1. Unticking this option resolves the crash!
To push the user to the iTunes store for desired items I'm using the following function:
func openStoreProductWithiTunesItemIdentifier(identifier: String) {
let storeViewController = SKStoreProductViewController()
storeViewController.delegate = self
let parameters = [ SKStoreProductParameterITunesItemIdentifier : identifier, SKStoreProductParameterAffiliateToken : ITUNES_AFFILIATE_ID]
storeViewController.loadProductWithParameters(parameters) { [weak self] (loaded, error) -> Void in
if loaded {
self!.navigationController?.pushViewControllerWithHandler(storeViewController, animated: true) {
LilithProgressHUD.hide() // custom progress hud
}
}
}
}
extension UINavigationController {
func pushViewControllerWithHandler(viewController: UIViewController, animated: Bool, completion: Void -> Void) {
CATransaction.begin()
CATransaction.setCompletionBlock(completion)
pushViewController(viewController, animated: animated)
CATransaction.commit()
}
}
Called by
let trackID = "thisIsMyTrackID"
openStoreProductWithiTunesItemIdentifier(trackID)
This results in
If I'm instead of:
self!.navigationController?.pushViewControllerWithHandler(storeViewController, animated: true) {
LilithProgressHUD.hide() // custom progress hud
}
Using:
self?.presentViewController(storeViewController, animated: true, completion: {
LilithProgressHUD.hide() // custom progress hud
})
, it is working. But I need the controller to push within the navigationController to fit the rest of the views and animations. What am I missing? Help is very appreciated.
Backtrace as requested:
(lldb) bt all
* thread #1: tid = 0x9bb48, 0x000000018fcac524 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
frame #0: 0x000000018fcac524 libobjc.A.dylib`objc_exception_throw
frame #1: 0x0000000191274108 CoreFoundation`+[NSException raise:format:] + 116
frame #2: 0x000000019dca04d0 StoreKit`-[SKStoreProductViewController _throwUnsupportedPresentationException] + 76
frame #3: 0x000000019dc9ed24 StoreKit`-[SKStoreProductViewController willMoveToParentViewController:] + 108
frame #4: 0x0000000197159174 UIKit`-[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 568
frame #5: 0x000000019714f580 UIKit`-[UINavigationController pushViewController:transition:forceImmediate:] + 1220
frame #6: 0x000000019714f06c UIKit`-[UINavigationController pushViewController:animated:] + 652
* frame #7: 0x00000001000a32f4 cya`UINavigationController.pushViewControllerWithHandler(viewController=0x00000001028ae9c0, animated=true, completion=0x00000001000a35c4 cya`partial apply forwarder for reabstraction thunk helper from #callee_unowned #convention(block) () -> (#unowned ()) to #callee_owned () -> (#unowned ()) with unmangled suffix ".16" at UINavigationControllerExtensions.swift, self=0x0000000103844600) -> ()) -> () + 504 at UINavigationControllerExtensions.swift:24
frame #8: 0x00000001000a3578 cya`#objc UINavigationController.pushViewControllerWithHandler(UIViewController, animated : Bool, completion : () -> ()) -> () + 196 at UINavigationControllerExtensions.swift:0
frame #9: 0x00000001001b04f4 cya`DJProfileAsUserMusicTableVC.(loaded=true, error=nil, self=0x0000000102a358d0, storeViewController=0x00000001028ae9c0) -> ()).(closure #1) + 416 at DJProfileAsUserMusicTableVC.swift:697
frame #10: 0x00000001001b0654 cya`thunk + 56 at DJProfileAsUserMusicTableVC.swift:0
frame #11: 0x00000001001b0714 cya`thunk + 36 at DJProfileAsUserMusicTableVC.swift:0
frame #12: 0x00000001001b0804 cya`thunk + 80 at DJProfileAsUserMusicTableVC.swift:0
frame #13: 0x000000019dc9fb84 StoreKit`-[SKStoreProductViewController _loadDidFinishWithResult:error:] + 92
frame #14: 0x000000019127a160 CoreFoundation`__invoking___ + 144
frame #15: 0x000000019116dc3c CoreFoundation`-[NSInvocation invoke] + 284
frame #16: 0x0000000192e158bc FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
frame #17: 0x0000000192e15728 FrontBoardServices`-[FBSSerialQueue _performNext] + 176
frame #18: 0x0000000192e15ad0 FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 56
frame #19: 0x0000000191222278 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #20: 0x0000000191221bc0 CoreFoundation`__CFRunLoopDoSources0 + 524
frame #21: 0x000000019121f7c0 CoreFoundation`__CFRunLoopRun + 804
frame #22: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #23: 0x0000000192bd1198 GraphicsServices`GSEventRunModal + 180
frame #24: 0x0000000197128628 UIKit`-[UIApplication _run] + 684
frame #25: 0x0000000197123360 UIKit`UIApplicationMain + 208
frame #26: 0x000000010020c08c cya`main + 144 at AppDelegate.swift:19
frame #27: 0x00000001901305b8 libdyld.dylib`start + 4
thread #3: tid = 0x9bbc9, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x0000000190305188 libsystem_pthread.dylib`_pthread_wqthread + 968
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #4: tid = 0x9bbca, 0x0000000190304db0 libsystem_pthread.dylib`start_wqthread
frame #0: 0x0000000190304db0 libsystem_pthread.dylib`start_wqthread
thread #7: tid = 0x9bbdc, 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8, name = 'gputools.smt_poll.0x17403cde0'
frame #0: 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x000000019016027c libsystem_c.dylib`nanosleep + 212
frame #2: 0x000000019016019c libsystem_c.dylib`usleep + 64
frame #3: 0x00000001025adeb0 GPUToolsCore`smt_poll_thread_entry(void*) + 136
frame #4: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #5: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #6: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #8: tid = 0x9bbef, 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8, name = 'gputools.smt_poll.0x170220020'
frame #0: 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x000000019016027c libsystem_c.dylib`nanosleep + 212
frame #2: 0x000000019016019c libsystem_c.dylib`usleep + 64
frame #3: 0x00000001025adeb0 GPUToolsCore`smt_poll_thread_entry(void*) + 136
frame #4: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #5: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #6: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #9: tid = 0x9bbf4, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.uikit.eventfetch-thread'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x0000000191c5cb1c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
frame #6: 0x0000000191c7d60c Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 96
frame #7: 0x0000000197a9dc7c UIKit`-[UIEventFetcher threadMain] + 136
frame #8: 0x0000000191d5a50c Foundation`__NSThread__start__ + 1024
frame #9: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #10: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #11: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #12: tid = 0x9bbfb, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.NSURLConnectionLoader'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x000000019193bcec CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 336
frame #6: 0x0000000191d5a50c Foundation`__NSThread__start__ + 1024
frame #7: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #8: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #9: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #14: tid = 0x9bbfd, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'AVAudioSession Notify Thread'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x00000001aa8f1fe8 AVFAudio`GenericRunLoopThread::Entry(void*) + 164
frame #6: 0x00000001aa917f14 AVFAudio`CAPThread::Entry(CAPThread*) + 84
frame #7: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #8: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #9: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #17: tid = 0x9bc0f, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.squareup.SocketRocket.NetworkThread'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x0000000191c5cb1c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
frame #6: 0x00000001003f57ec cya`-[_FSRRunLoopThread main](self=0x00000001740918f0, _cmd=<unavailable>) + 252 at FSRWebSocket.m:1838
frame #7: 0x0000000191d5a50c Foundation`__NSThread__start__ + 1024
frame #8: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #9: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #10: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #18: tid = 0x9bc21, 0x000000019024223c libsystem_kernel.dylib`__select + 8, name = 'com.apple.CFSocket.private'
frame #0: 0x000000019024223c libsystem_kernel.dylib`__select + 8
frame #1: 0x0000000191228b84 CoreFoundation`__CFSocketManager + 640
frame #2: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #3: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #4: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #19: tid = 0x9bc70, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x000000019030536c libsystem_pthread.dylib`_pthread_wqthread + 1452
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #20: tid = 0x9bc77, 0x0000000190304db0 libsystem_pthread.dylib`start_wqthread
frame #0: 0x0000000190304db0 libsystem_pthread.dylib`start_wqthread
thread #21: tid = 0x9bc78, 0x0000000000000000
frame #0: 0x0000000000000000
(lldb)
Backtrace without exception breakpoint:
(lldb) bt all
warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
* thread #1: tid = 0x9c221, 0x0000000190242014 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0000000190242014 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x0000000190309460 libsystem_pthread.dylib`pthread_kill + 112
frame #2: 0x00000001901b63f4 libsystem_c.dylib`abort + 140
frame #3: 0x000000018fc812d4 libc++abi.dylib`abort_message + 132
frame #4: 0x000000018fc9ecc0 libc++abi.dylib`default_terminate_handler() + 304
frame #5: 0x000000018fcac844 libobjc.A.dylib`_objc_terminate() + 124
frame #6: 0x000000018fcac844 libobjc.A.dylib`_objc_terminate() + 124
frame #7: 0x000000018fc9b66c libc++abi.dylib`std::__terminate(void (*)()) + 16
frame #8: 0x000000018fc9b234 libc++abi.dylib`__cxa_rethrow + 144
frame #9: 0x000000018fcac71c libobjc.A.dylib`objc_exception_rethrow + 44
frame #10: 0x000000019114e0bc CoreFoundation`CFRunLoopRunSpecific + 560
frame #11: 0x0000000192bd1198 GraphicsServices`GSEventRunModal + 180
frame #12: 0x0000000197128628 UIKit`-[UIApplication _run] + 684
frame #13: 0x0000000197123360 UIKit`UIApplicationMain + 208
* frame #14: 0x00000001001e408c cya`main + 144 at AppDelegate.swift:19
frame #15: 0x00000001901305b8 libdyld.dylib`start + 4
thread #5: tid = 0x9c29d, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x000000019030536c libsystem_pthread.dylib`_pthread_wqthread + 1452
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #7: tid = 0x9c2a7, 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8, name = 'gputools.smt_poll.0x174036a80'
frame #0: 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x000000019016027c libsystem_c.dylib`nanosleep + 212
frame #2: 0x000000019016019c libsystem_c.dylib`usleep + 64
frame #3: 0x000000010257deb0 GPUToolsCore`smt_poll_thread_entry(void*) + 136
frame #4: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #5: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #6: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #8: tid = 0x9c2b2, 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8, name = 'gputools.smt_poll.0x1740366c0'
frame #0: 0x0000000190242314 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x000000019016027c libsystem_c.dylib`nanosleep + 212
frame #2: 0x000000019016019c libsystem_c.dylib`usleep + 64
frame #3: 0x000000010257deb0 GPUToolsCore`smt_poll_thread_entry(void*) + 136
frame #4: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #5: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #6: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #9: tid = 0x9c2b6, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.uikit.eventfetch-thread'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x0000000191c5cb1c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
frame #6: 0x0000000191c7d60c Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 96
frame #7: 0x0000000197a9dc7c UIKit`-[UIEventFetcher threadMain] + 136
frame #8: 0x0000000191d5a50c Foundation`__NSThread__start__ + 1024
frame #9: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #10: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #11: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #10: tid = 0x9c2b7, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x000000019030536c libsystem_pthread.dylib`_pthread_wqthread + 1452
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #12: tid = 0x9c2bf, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.NSURLConnectionLoader'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x000000019193bcec CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 336
frame #6: 0x0000000191d5a50c Foundation`__NSThread__start__ + 1024
frame #7: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #8: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #9: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #14: tid = 0x9c2c3, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'AVAudioSession Notify Thread'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x00000001aa8f1fe8 AVFAudio`GenericRunLoopThread::Entry(void*) + 164
frame #6: 0x00000001aa917f14 AVFAudio`CAPThread::Entry(CAPThread*) + 84
frame #7: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #8: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #9: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #15: tid = 0x9c2cc, 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.squareup.SocketRocket.NetworkThread'
frame #0: 0x000000019022416c libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x0000000190223fdc libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x0000000191221cec CoreFoundation`__CFRunLoopServiceMachPort + 192
frame #3: 0x000000019121f908 CoreFoundation`__CFRunLoopRun + 1132
frame #4: 0x000000019114e048 CoreFoundation`CFRunLoopRunSpecific + 444
frame #5: 0x0000000191c5cb1c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
frame #6: 0x00000001003cd7ec cya`-[_FSRRunLoopThread main](self=0x0000000170097c00, _cmd=<unavailable>) + 252 at FSRWebSocket.m:1838
frame #7: 0x0000000191d5a50c Foundation`__NSThread__start__ + 1024
frame #8: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #9: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #10: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #16: tid = 0x9c2d8, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x000000019030536c libsystem_pthread.dylib`_pthread_wqthread + 1452
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #18: tid = 0x9c2e8, 0x000000019024223c libsystem_kernel.dylib`__select + 8, name = 'com.apple.CFSocket.private'
frame #0: 0x000000019024223c libsystem_kernel.dylib`__select + 8
frame #1: 0x0000000191228b84 CoreFoundation`__CFSocketManager + 640
frame #2: 0x0000000190307860 libsystem_pthread.dylib`_pthread_body + 240
frame #3: 0x0000000190307770 libsystem_pthread.dylib`_pthread_start + 284
frame #4: 0x0000000190304dbc libsystem_pthread.dylib`thread_start + 4
thread #19: tid = 0x9c355, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x0000000190305188 libsystem_pthread.dylib`_pthread_wqthread + 968
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #20: tid = 0x9c35f, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x000000019030536c libsystem_pthread.dylib`_pthread_wqthread + 1452
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
thread #21: tid = 0x9c360, 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x0000000190242a88 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x0000000190305188 libsystem_pthread.dylib`_pthread_wqthread + 968
frame #2: 0x0000000190304db4 libsystem_pthread.dylib`start_wqthread + 4
(lldb)
The exception and stack trace tell you that the store view controller isn't happy about being pushed into a nav stack. Your test shows it is happy being presented. From the documentation:
present the view controller modally from another view controller in your app
So, you should present it modally.
While it's possible that you could perhaps make it work in some other way it's likely to break in the future if you don't follow the (inconvenient) guidelines.
i have an issue where my app crashes when attached to the debugger in just one case. My App downloads json data and transform it into core data objects. For this purpose i start a background thread to load it and have a successHandler handling the import:
RemoteConnectionService.sharedInstance.sendRequest(UserRequest(userID: user!.webID.integerValue), successHandler: { requestHandler, result in
var userData = result["user"] as! [String: AnyObject]
self.user?.update(userData)
self.tableView.reloadData()
}, errorHandler: nil)
this works everywhere as expected. the successHandler is called on the main thread, core data gets updated and all. but when doing this special request (it happens always and only with this request) Xcode stop pointing to
class AppDelegate: UIResponder, UIApplicationDelegate
with no specific failure reason. here's the backtrace (via bt):
* thread #1: tid = 0x6ab4b, 0x00000001051b19c0 libobjc.A.dylib`objc_release + 16, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00000001051b19c0 libobjc.A.dylib`objc_release + 16
frame #1: 0x00000001051b28cd libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 591
frame #2: 0x00000001082348d8 CFNetwork`-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 207
frame #3: 0x0000000108234a37 CFNetwork`-[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
frame #4: 0x00000001081043a7 CFNetwork`___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 107
frame #5: 0x00000001081d1891 CFNetwork`___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 273
frame #6: 0x00000001080ef6e6 CFNetwork`RunloopBlockContext::_invoke_block(void const*, void*) + 72
frame #7: 0x00000001057c13d4 CoreFoundation`CFArrayApplyFunction + 68
frame #8: 0x00000001080ef5a7 CFNetwork`RunloopBlockContext::perform() + 133
frame #9: 0x00000001080ef3e6 CFNetwork`MultiplexerSource::perform() + 256
frame #10: 0x00000001080ef1fc CFNetwork`MultiplexerSource::_perform(void*) + 72
frame #11: 0x00000001057ee4b1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #12: 0x00000001057e437d CoreFoundation`__CFRunLoopDoSources0 + 269
frame #13: 0x00000001057e39b4 CoreFoundation`__CFRunLoopRun + 868
frame #14: 0x00000001057e33e6 CoreFoundation`CFRunLoopRunSpecific + 470
frame #15: 0x000000010abdba3e GraphicsServices`GSEventRunModal + 161
frame #16: 0x00000001063cab60 UIKit`UIApplicationMain + 1282
* frame #17: 0x00000001049556b7 App`main + 135 at AppDelegate.swift:13
frame #18: 0x00000001088fd145 libdyld.dylib`start + 1
What i don't get here is that when trying to profile it in instruments or just running it in the simulator without Xcode it works just fine. On the device it crashes on that particular request no matter what.
device backtrace looks a bit different:
* thread #1: tid = 0x19e6ab, 0x0000000192490174 libobjc.A.dylib`objc_release + 20, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x13723bec8)
frame #0: 0x0000000192490174 libobjc.A.dylib`objc_release + 20
frame #1: 0x0000000192491724 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
frame #2: 0x00000001817d2e08 CFNetwork`-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 216
frame #3: 0x00000001817d2f7c CFNetwork`-[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 60
frame #4: 0x00000001816a78e4 CFNetwork`___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 104
frame #5: 0x0000000181770540 CFNetwork`___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 104
frame #6: 0x0000000181693b54 CFNetwork`RunloopBlockContext::_invoke_block(void const*, void*) + 76
frame #7: 0x0000000181c10aac CoreFoundation`CFArrayApplyFunction + 68
frame #8: 0x0000000181693a00 CFNetwork`RunloopBlockContext::perform() + 136
frame #9: 0x00000001816938b4 CFNetwork`MultiplexerSource::perform() + 312
frame #10: 0x00000001816936e0 CFNetwork`MultiplexerSource::_perform(void*) + 68
frame #11: 0x0000000181ce69ec CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #12: 0x0000000181ce5c90 CoreFoundation`__CFRunLoopDoSources0 + 264
frame #13: 0x0000000181ce3d40 CoreFoundation`__CFRunLoopRun + 712
frame #14: 0x0000000181c110a4 CoreFoundation`CFRunLoopRunSpecific + 396
frame #15: 0x000000018adab5a4 GraphicsServices`GSEventRunModal + 168
frame #16: 0x0000000186542aa4 UIKit`UIApplicationMain + 1488
* frame #17: 0x0000000100069c8c App`main + 164 at AppDelegate.swift:13
frame #18: 0x0000000192ae6a08 libdyld.dylib`start + 4
Any suggestions on how to debug this? Very much appreciated :)
I've designed a UIViewController in a .xib file. It uses Autolayout.
I have in it a UISlider which change the text of a UILabel when its value change : I've linked the sent event "Value changed" to my header file and then implements the function in the .m file of my controller. This method only changes the text of the label, depending of the value of the slider.
When the view appears, the slider is not show (set outside of the screen). I present it on the view using animations.
The problem is when I change the value of my slider, it calls automatically
-(void)viewDidLayoutSubviews
{
}
And unfortunately, it reset all the subviews of my controller's view to their original positions.
How to present the slider to "destroy" the actual layout.
EDIT
My slider's connections in the interface builder :
and the code of the associated function :
- (IBAction)sliderDureeValueChanged:(id)sender {
dureeMois = (int) sliderDuree.value;
if (sliderDuree.maximumValue == sliderDuree.value)
{
[lblDuree setText:#"Max"];
}
else if (sliderDuree.minimumValue == sliderDuree.value)
{
[lblDuree setText:#"Min"];
}
else
{
[lblDuree setText:[NSString stringWithFormat:#"%d month",dureeMois]
}
}
EDIT2
Here is the stack obtained with [NSThread callStackSymbols] in viewDidLayoutSubviews when called by using the slider.
2013-07-16 16:39:47.420 MyApp[2363:907] Stack trace : (
0 MyApp 0x0003cd5f -[GraphiqueFVViewController viewDidLayoutSubviews] + 50
1 UIKit 0x34f938c9 <redacted> + 456
2 QuartzCore 0x34d3dd8b <redacted> + 214
3 QuartzCore 0x34d3d929 <redacted> + 460
4 QuartzCore 0x34d3e85d <redacted> + 16
5 QuartzCore 0x34d3e243 <redacted> + 238
6 QuartzCore 0x34d3e051 <redacted> + 316
7 QuartzCore 0x34d3deb1 <redacted> + 60
8 CoreFoundation 0x3315d6cd <redacted> + 20
9 CoreFoundation 0x3315b9c1 <redacted> + 276
10 CoreFoundation 0x3315bd17 <redacted> + 742
11 CoreFoundation 0x330ceebd CFRunLoopRunSpecific + 356
12 CoreFoundation 0x330ced49 CFRunLoopRunInMode + 104
13 GraphicsServices 0x36c922eb GSEventRunModal + 74
14 UIKit 0x34fe4301 UIApplicationMain + 1120
15 MyApp 0x00021add main + 116
16 libdyld.dylib 0x3b264b20 <redacted> + 0
and backtracing all in the debug area :
* thread #1: tid = 0x2503, 0x00101d46 MyApp`-[GraphiqueFVViewController viewDidLayoutSubviews](self=0x1ed972f0, _cmd=0x3541247c) + 42 at GraphiqueFVViewController.m:386, stop reason = breakpoint 2.1
frame #0: 0x00101d46 MyApp`-[GraphiqueFVViewController viewDidLayoutSubviews](self=0x1ed972f0, _cmd=0x3541247c) + 42 at GraphiqueFVViewController.m:386
frame #1: 0x34f938c8 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 456
frame #2: 0x34d3dd8a QuartzCore`-[CALayer layoutSublayers] + 214
frame #3: 0x34d3d928 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 460
frame #4: 0x34d3e85c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #5: 0x34d3e242 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 238
frame #6: 0x34d3e050 QuartzCore`CA::Transaction::commit() + 316
frame #7: 0x34d3deb0 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 60
frame #8: 0x3315d6cc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
frame #9: 0x3315b9c0 CoreFoundation`__CFRunLoopDoObservers + 276
frame #10: 0x3315bd16 CoreFoundation`__CFRunLoopRun + 742
frame #11: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #12: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
frame #13: 0x36c922ea GraphicsServices`GSEventRunModal + 74
frame #14: 0x34fe4300 UIKit`UIApplicationMain + 1120
frame #15: 0x000e6a84 MyApp`main(argc=1, argv=0x2fd1bd18) + 116 at main.m:16
frame #16: 0x3b264b20 libdyld.dylib`start + 4
thread #3: tid = 0x2903, 0x3b31b648 libsystem_kernel.dylib`kevent64 + 24
frame #0: 0x3b31b648 libsystem_kernel.dylib`kevent64 + 24
frame #1: 0x3b2544f0 libdispatch.dylib`_dispatch_mgr_invoke + 796
frame #2: 0x3b246df8 libdispatch.dylib`_dispatch_mgr_thread$VARIANT$up + 36
thread #5: tid = 0x2b03, 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
frame #0: 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
frame #1: 0x3b31b04c libsystem_kernel.dylib`mach_msg + 40
frame #2: 0x3315d044 CoreFoundation`__CFRunLoopServiceMachPort + 128
frame #3: 0x3315bda2 CoreFoundation`__CFRunLoopRun + 882
frame #4: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #5: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
frame #6: 0x390cd504 WebCore`RunWebThread(void*) + 444
frame #7: 0x3b284310 libsystem_c.dylib`_pthread_start + 308
thread #7: tid = 0x241f, 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
frame #0: 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
frame #1: 0x3b31b04c libsystem_kernel.dylib`mach_msg + 40
frame #2: 0x3315d044 CoreFoundation`__CFRunLoopServiceMachPort + 128
frame #3: 0x3315bda2 CoreFoundation`__CFRunLoopRun + 882
frame #4: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #5: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
frame #6: 0x33a1b3d4 Foundation`+[NSURLConnection(Loader) _resourceLoadLoop:] + 308
frame #7: 0x33a9ee84 Foundation`__NSThread__main__ + 972
frame #8: 0x3b284310 libsystem_c.dylib`_pthread_start + 308
thread #8: tid = 0x2d03, 0x3b32b594 libsystem_kernel.dylib`select$DARWIN_EXTSN + 20
frame #0: 0x3b32b594 libsystem_kernel.dylib`select$DARWIN_EXTSN + 20
frame #1: 0x331611f6 CoreFoundation`__CFSocketManager + 678
frame #2: 0x3b284310 libsystem_c.dylib`_pthread_start + 308
thread #11: tid = 0x3003, 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
frame #0: 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
frame #1: 0x3b27cd2e libsystem_c.dylib`_pthread_cond_wait + 646
frame #2: 0x3b27caa4 libsystem_c.dylib`pthread_cond_timedwait + 44
frame #3: 0x37088c74 JavaScriptCore`WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 108
frame #4: 0x3719a556 JavaScriptCore`JSC::BlockAllocator::blockFreeingThreadMain() + 82
frame #5: 0x371acfaa JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 14
frame #6: 0x3b284310 libsystem_c.dylib`_pthread_start + 308
thread #12: tid = 0x3103, 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
frame #0: 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
frame #1: 0x3b31b04c libsystem_kernel.dylib`mach_msg + 40
frame #2: 0x3315d044 CoreFoundation`__CFRunLoopServiceMachPort + 128
frame #3: 0x3315bda2 CoreFoundation`__CFRunLoopRun + 882
frame #4: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #5: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
frame #6: 0x39167d06 WebCore`WebCore::runLoaderThread(void*) + 142
frame #7: 0x371acfaa JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 14
frame #8: 0x3b284310 libsystem_c.dylib`_pthread_start + 308
thread #15: tid = 0x3403, 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
frame #0: 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
frame #1: 0x3b27cd2e libsystem_c.dylib`_pthread_cond_wait + 646
frame #2: 0x3b286f18 libsystem_c.dylib`pthread_cond_wait + 40
frame #3: 0x37088c46 JavaScriptCore`WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 62
frame #4: 0x392e1e8c WebCore`WTF::PassOwnPtr<WebCore::StorageTask> WTF::MessageQueue<WebCore::StorageTask>::waitForMessageFilteredWithTimeout<bool (WebCore::StorageTask*)>(WTF::MessageQueueWaitResult&, bool (&)(WebCore::StorageTask*), double) + 56
frame #5: 0x392e1e40 WebCore`WebCore::StorageThread::threadEntryPoint() + 124
frame #6: 0x371acfaa JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 14
frame #7: 0x3b284310 libsystem_c.dylib`_pthread_start + 308
thread #17: tid = 0x3903, 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x3b279cfa libsystem_c.dylib`_pthread_workq_return + 18
frame #2: 0x3b279a16 libsystem_c.dylib`_pthread_wqthread + 366
thread #18: tid = 0x3b03, 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x3b279cfa libsystem_c.dylib`_pthread_workq_return + 18
frame #2: 0x3b279a16 libsystem_c.dylib`_pthread_wqthread + 366
thread #19: tid = 0x3707, 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #0: 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
frame #1: 0x3b279cfa libsystem_c.dylib`_pthread_workq_return + 18
frame #2: 0x3b279a16 libsystem_c.dylib`_pthread_wqthread + 366
Hey super late to the party here but we had relatively the same issue and I wanted to shed a little light on it.
We had 3 views contained in our main view: a label, a view containing login fields, and a view containing a facebook button. When you pressed a button it would toggle between the 2 login views and when it encountered an error, the label would scale to 0, switch the text, then scale back up to 1. We found that when the label animated and changed size, the constraints would be reapplied and the first view would be toggled back into position.
We found that the documentation for "didLayoutSubviews" says it gets called on the parent of a view when that view changes bounds. We're assuming that it also counts as changing the bounds when you modify the transform of the view.
So the problem is that if a view animates, it will cause all of its sibling views to reposition to their original states.
We fixed this by putting the label inside of its own view. When it animates, it calls "layoutSubviews" on its parent, which only lays out itself.