2016-05-16 101 views
0

在我的應用程序中,我使用UICollectionView顯示包含圖像和文本的自定義單元格的網格視圖。爲支持所有屏幕尺寸,我已覆蓋 IUICollectionViewDelegateFlowLayout委託的GetSizeForItem方法。從iOS 8.1到9.2(在模擬器和設備上測試),每件事情都很棒。 對於iOS 9.3模擬器網格視圖呈現正確。但只要我旋轉屏幕它崩潰與以下錯誤:Xamarin.iOS UICollectionView應用程序崩潰,當設備旋轉爲iOS 9.3

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[NSNull length]: unrecognized selector sent to instance 0x9065398 Native stack trace: 0 CoreFoundation
0x08e38494 exceptionPreprocess + 180 1 libobjc.A.dylib
0x091abe02 objc_exception_throw + 50 2 CoreFoundation
0x08e42253 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 3
CoreFoundation 0x08d7789d ___forwarding_
+ 1037 4 CoreFoundation 0x08d7746e _CF_forwarding_prep_0 + 14 5 CoreFoundation 0x08cf0cdb CFStringCompareWithOptionsAndLocale + 203 6 Foundation
0x00da5770 -[NSString compare:options:range:locale:] + 175 7
Foundation 0x00da56b9 -[NSString compare:options:range:] + 72 8 Foundation
0x00dab7f2 -[NSString caseInsensitiveCompare:] + 81 9 UIKit
0x0156e021 -[UIPhysicalKeyboardEvent _matchesKeyCommand:] + 357 10 UIKit 0x0147035e -[UIResponder _keyCommandForEvent:target:] + 446 11 UIKit 0x01470531 -[UIResponder _keyCommandForEvent:target:] + 913 12 UIKit 0x0147019b -[UIResponder _keyCommandForEvent:] + 48 13 UIKit
0x0123e287 -[UIApplication handleKeyHIDEvent:] + 380 14 UIKit
0x0121234d _UIApplicationHandleEventQueue + 6743 15 CoreFoundation
0x08d4ae5f CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15 16 CoreFoundation 0x08d40aeb __CFRunLoopDoSources0 + 523 17 CoreFoundation 0x08d3ff08 __CFRunLoopRun + 1032 18 CoreFoundation
0x08d3f846 CFRunLoopRunSpecific + 470 19 CoreFoundation
0x08d3f65b CFRunLoopRunInMode + 123 20 GraphicsServices
0x09b3f664 GSEventRunModal + 192 21 GraphicsServices
0x09b3f4a1 GSEventRun + 104 22 UIKit
0x01218eb9 UIApplicationMain + 160 23 ???
0x18c98020 0x0 + 415858720 24 ???
0x18c97e18 0x0 + 415858200 25 ???
0x18c95f98 0x0 + 415850392 26 ???
0x18c95cd4 0x0 + 415849684 27 ???
0x18c95e60 0x0 + 415850080 28 libmonosgen-2.0.dylib
0x088cee81 mono_jit_runtime_invoke + 705 29 libmonosgen-2.0.dylib
0x08a7e0af mono_runtime_invoke + 127 30 libmonosgen-2.0.dylib
0x08a82f71 mono_runtime_exec_main + 401 31 libmonosgen-2.0.dylib
0x08a82d35 mono_runtime_run_main + 629 32 libmonosgen-2.0.dylib
0x0893ac8d mono_jit_exec + 93 33 TutorMeNot.iOS
0x001ff440 xamarin_main + 2384 34 TutorMeNot.iOS
0x001da5a1 main + 113 35 libdyld.dylib
0x0a62ca25 start + 1 36 ???
0x00000003 0x0 + 3

回答

0

該問題是沒有更多的代碼相關。這是我的觀察結果,解決了我的問題。

我使用TabBarController。在其中一個選項卡中,我使用UICollectionView和自定義單元格。 當我在iOS 9.3模擬器上運行應用程序時,它正確顯示我的集合視圖。

旋轉模擬器使用鍵盤快捷鍵「Command + arrow」。 只要我按下命令它就會崩潰。 但是,當我旋轉模擬器使用硬件 - >旋轉選項菜單它工作正常。

此外,我在iPod設備(iOS V9.3.2)上測試了這一點,並完美地工作。 爲了測試目的,我使用Objective-C創建了示例UICollectionView App。當我在iOS 9.3模擬器上構建並運行該示例時,它可以正常工作,屏幕旋轉時不會出現任何崩潰。

希望Xamarin團隊會尋找這個問題。

相關問題