так вот в чем проблема: мне нужно заполнить базовый UITableView
, используя данные, содержащиеся в документе JSON. Для того, чтобы разобрать его, я использовал код ниже (работает как шарм):Получение ошибки AutoLayout при анализе JSON в Swift 2
let urlPath = "http://mywebsite.com/jsonDocument"
let endpoint = NSURL(string: urlPath)
let request = NSMutableURLRequest(URL:endpoint!)
NSURLSession.sharedSession().dataTaskWithRequest(request) { (data, response, error) -> Void in
self.data_string = NSString(data: data!, encoding: NSUTF8StringEncoding)
print("JSON Downloaded")
self.UpdateTV()
}.resume()
UpdateTV
является в основном функцией, которая сортирует полученные данные и передает их в виде таблицы, вызывая reloadData
в конце процесса ,
На данный момент не только все становится невероятно медленно ... но XCode также получает грязный с этой ошибкой (умножается на каждый UITableViewCell
)
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 0x000000010a5bef45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c7bedeb objc_exception_throw + 48
2 CoreFoundation 0x000000010a5bee7d +[NSException raise:format:] + 205
3 Foundation 0x000000010ad58289 _AssertAutolayoutOnMainThreadOnly + 79
4 Foundation 0x000000010abb84e2 -[NSISEngine optimize] + 49
5 Foundation 0x000000010abb8da4 -[NSISEngine withBehaviors:performModifications:] + 245
6 UIKit 0x000000010bb79a4b -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
7 UIKit 0x000000010bb7a3cd -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 154
8 UIKit 0x000000010bb7a03d -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 309
9 UIKit 0x000000010bb7a3f9 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 198
10 UIKit 0x000000010bb79a54 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
11 UIKit 0x000000010bb7a7dc -[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 844
12 UIKit 0x000000010bb7b2a3 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeeded] + 272
13 UIKit 0x000000010b35c332 -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 159
14 UIKit 0x000000010b36be67 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 749
15 QuartzCore 0x0000000110ea859a -[CALayer layoutSublayers] + 146
16 QuartzCore 0x0000000110e9ce70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
17 UIKit 0x000000010b35baa1 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1083
18 UIKit 0x000000010b624f63 -[UITableViewCell _setFrame:skipLayout:] + 373
19 UIKit 0x000000010b624de8 -[UITableViewCell setFrame:] + 58
20 UIKit 0x000000010b40270f __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 3228
21 UIKit 0x000000010b360c10 +[UIView(Animation) performWithoutAnimation:] + 65
22 UIKit 0x000000010b401a5a -[UITableView _configureCellForDisplay:forIndexPath:] + 475
23 UIKit 0x000000010b40ce58 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 828
24 UIKit 0x000000010b40cf3f -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
25 UIKit 0x000000010b3e2307 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3187
26 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
27 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
28 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
29 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
30 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
31 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
32 UIKit 0x000000010b3e2d57 -[UITableView _updateVisibleCellsNow:isRecursive:] + 5827
33 UIKit 0x000000010b415d1c -[UITableView _performWithCachedTraitCollection:] + 92
34 UIKit 0x000000010b3fd884 -[UITableView layoutSubviews] + 223
35 UIKit 0x000000010b36be40 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
36 QuartzCore 0x0000000110ea859a -[CALayer layoutSublayers] + 146
37 QuartzCore 0x0000000110e9ce70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
38 QuartzCore 0x0000000110e9ccee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
39 QuartzCore 0x0000000110e91475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
40 QuartzCore 0x0000000110ebec0a _ZN2CA11Transaction6commitEv + 486
41 QuartzCore 0x0000000110ebeefc _ZN2CA11Transaction14release_threadEPv + 224
42 libsystem_pthread.dylib 0x000000010d5d839c _pthread_tsd_cleanup + 470
43 libsystem_pthread.dylib 0x000000010d5d7f78 _pthread_exit + 117
44 libsystem_pthread.dylib 0x000000010d5d6596 pthread_attr_getschedpolicy + 0
45 libsystem_pthread.dylib 0x000000010d5d4375 start_wqthread + 13
)
Работал как очарование! Благодаря :) –