2015-07-12 86 views
1

這個崩潰是由崩潰報告工具報告的,它只發生在iOS7上,我無法重現。UITableView導致iOS7崩潰?

它看起來像是什麼叫scrollView:contentSizeForZoomScale:withProposedSize,該單元格包含2個按鈕,根據傳遞給它的數據來調整大小(沒有scrollViews,並且無處設置任何UIScrollView的委託)。

有關什麼導致scrollView委託方法調用單元格的任何想法?

Fatal Exception: NSInvalidArgumentException 
-[ProfileContactUserCell scrollView:contentSizeForZoomScale:withProposedSize:]: unrecognized selector sent to instance 0x127592a20 

Thread : Fatal Exception: NSInvalidArgumentException 
0 CoreFoundation     0x000000018169b100 __exceptionPreprocess 
1 libobjc.A.dylib    0x000000018dba41fc objc_exception_throw 
2 CoreFoundation     0x000000018169fdb4 __methodDescriptionForSelector 
3 CoreFoundation     0x000000018169dae0 ___forwarding___ 
4 CoreFoundation     0x00000001815bd78c _CF_forwarding_prep_0 
5 UIKit       0x0000000184680d38 -[UIScrollView setFrame:] 
6 UIKit       0x000000018467b12c -[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] 
7 UIKit       0x000000018476ad20 -[UIScrollView _resizeWithOldSuperviewSize:] 
8 CoreFoundation     0x00000001815ad1dc __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke 
9 CoreFoundation     0x00000001815ad0a8 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] 
10 UIKit       0x000000018466a9f8 -[UIView(Geometry) resizeSubviewsWithOldSize:] 
11 UIKit       0x000000018465b9f8 -[UIView(Geometry) setFrame:] 
12 UIKit       0x00000001847400d8 -[UITableViewCell setFrame:] 
13 UIKit       0x00000001847adf74 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke 
14 UIKit       0x0000000184672de0 +[UIView(Animation) performWithoutAnimation:] 
15 UIKit       0x00000001847adcc8 -[UITableView _configureCellForDisplay:forIndexPath:] 
16 UIKit       0x00000001847ac90c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] 
17 UIKit       0x000000018474ae4c -[UITableView _updateVisibleCellsNow:] 
18 UIKit       0x000000018473d8a4 -[UITableView _visibleCells] 
19 UIKit       0x000000018473d768 -[UITableView setSeparatorStyle:] 
20 Company     0x00000001000ae7ac -[ProfileViewController viewDidLoad] (ProfileViewController.m:104) 
21 UIKit       0x0000000184664658 -[UIViewController loadViewIfRequired] 
22 UIKit       0x00000001846643dc -[UIViewController view] 
23 UIKit       0x0000000184811850 -[UINavigationController _startCustomTransition:] 
24 UIKit       0x000000018471bf3c -[UINavigationController _startDeferredTransitionIfNeeded:] 
25 UIKit       0x000000018471bd0c -[UINavigationController __viewWillLayoutSubviews] 
26 UIKit       0x000000018471bc8c -[UILayoutContainerView layoutSubviews] 
27 UIKit       0x000000018465efe0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] 
28 QuartzCore      0x0000000184250258 -[CALayer layoutSublayers] 
29 QuartzCore      0x000000018424ae20 CA::Layer::layout_if_needed(CA::Transaction*) 
30 QuartzCore      0x000000018424acd8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) 
31 QuartzCore      0x000000018424a560 CA::Context::commit_transaction(CA::Transaction*) 
32 QuartzCore      0x000000018424a304 CA::Transaction::commit() 
33 UIKit       0x0000000184663154 _UIApplicationHandleEventQueue 
34 CoreFoundation     0x000000018165b7f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 
35 CoreFoundation     0x000000018165ab50 __CFRunLoopDoSources0 
36 CoreFoundation     0x0000000181658de8 __CFRunLoopRun 
37 CoreFoundation     0x0000000181599dd0 CFRunLoopRunSpecific 
38 GraphicsServices    0x0000000187281c0c GSEventRunModal 
39 UIKit       0x00000001846cafc4 UIApplicationMain 
40 Company     0x0000000100072c1c main (main.m:13) 
41 libdyld.dylib     0x000000018e197aa0 start 

編輯: 實施了方法,它看起來像它被稱爲:

<UITableViewCellScrollView: 0x78e39ee0; frame = (0 0; 320 44); autoresize = W+H; gestureRecognizers = <NSArray: 0x78eafc10>; layer = <CALayer: 0x78e354a0>; contentOffset: {0, 0}> 

回答

1

在iOS7蘋果更改了一個UITableViewCell的視圖層次。 在iOS 7中,contntView嵌入在UIScrollView中,並且在某些情況下(我還沒有弄清楚何時)在該單元上調用該方法的scrollView。

該修復程序是實現以下方法並返回poposedSize。此修復僅在iOS7上需要。 iOS8 +上的viewHierarchy已經改變爲它在iOS6上的樣子。 (在tableViewCell層次結構中不再使用UIScrollView)

- (CGSize)scrollView:(id)arg1 contentSizeForZoomScale:(float)arg2 withProposedSize:(CGSize)arg3 { 
    return arg3; 
}