Autolayout Issue Swift
wieseljonas opened this issue · 1 comments
wieseljonas commented
I am having an strange error on swift. Which makes a huge delay on the endRefreshing()
animation
2015-10-01 13:19:54.799 Mako[39509:354720] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x00000001118c3f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000112889deb objc_exception_throw + 48
2 CoreFoundation 0x00000001118c3e9d +[NSException raise:format:] + 205
3 Foundation 0x00000001120dc3b5 _AssertAutolayoutOnMainThreadOnly + 79
4 Foundation 0x0000000111f3c9d2 -[NSISEngine optimize] + 49
5 Foundation 0x0000000111f3d294 -[NSISEngine withBehaviors:performModifications:] + 245
6 UIKit 0x00000001100c8637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
7 UIKit 0x00000001100c8fb9 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 154
8 UIKit 0x00000001100c8c29 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 309
9 UIKit 0x00000001100c8fe5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 198
10 UIKit 0x00000001100c961d __60-[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded]_block_invoke + 98
11 UIKit 0x00000001100c8640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
12 UIKit 0x00000001100c917a -[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 254
13 UIKit 0x00000001100c9e8f -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeeded] + 272
14 UIKit 0x000000010f8e860c -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 159
15 UIKit 0x000000010f8f8143 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 749
16 QuartzCore 0x000000011272d36a -[CALayer layoutSublayers] + 146
17 QuartzCore 0x0000000112721bd0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
18 QuartzCore 0x0000000112721a4e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
19 QuartzCore 0x00000001127161d5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
20 QuartzCore 0x00000001127439f0 _ZN2CA11Transaction6commitEv + 508
21 QuartzCore 0x0000000112743cd4 _ZN2CA11Transaction14release_threadEPv + 224
22 libsystem_pthread.dylib 0x00000001136c139c _pthread_tsd_cleanup + 470
23 libsystem_pthread.dylib 0x00000001136c0f78 _pthread_exit + 117
24 libsystem_pthread.dylib 0x00000001136bf596 pthread_attr_getschedpolicy + 0
25 libsystem_pthread.dylib 0x00000001136bd375 start_wqthread + 13 )
Art3mS1d commented
It's because you invoke endRefreshing()
from background thread. You need to call it from main thread:
dispatch_async(dispatch_get_main_queue()) {
self.tableView.endRefreshing()
}