国のリストの検索機能を提供するためにUISearchController
を使用する機能を持つiOSアプリケーションを開発しています。最後のリリースまで、すべて正常に動作します。しかし、今、アプリケーションにいくつかの新しい機能を追加した後、私はクラッシュするアプリケーションを引き起こす変なバグに遭遇する。私がUISearchController(searchResultsController:nil)
に電話しようとするたびに、私のアプリは理由が[UIView setImage:]: unrecognized selector sent to instance
でクラッシュします。以前のリリースから以前のすべてのコミットを追跡していましたが、それでも原因は見つかりませんでした。私はUISearchController
に初期化することができないので、これをデバッグする方法の提案をお願いしたいと思います。[UIView setImage:]:init UISearchController
NOTE私はそれが不要に見つけるので、私は別の場所で呼び出しUISearchController(searchResultsController:nil)
を含むいくつかの方法を試してみました、いくつかのコードスニペットを提供UISearchController
の使用を削除しない、いくつかの不審な拡張...迅速ことを確認するを削除MacOSのエル・キャピタンは、私はへの切り替えを試みたEDIT 2
、
EDITマイアプリのターゲットバージョンが8.0であると私はXCodeの7.3.1に迅速2.2を使用している私に、別の偽クラッシュレポートを与えていません[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
しかし、残念ながら、まだ同じ理由でクラッシュしています。 Crashlyticsから
EDIT 3クラッシュログ:あなたが直接、このような方法で、ビューに画像を置くことができない
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x181ec2db0 __exceptionPreprocess
1 libobjc.A.dylib 0x181527f80 objc_exception_throw
2 CoreFoundation 0x181ec9c4c __methodDescriptionForSelector
3 CoreFoundation 0x181ec6bec ___forwarding___
4 CoreFoundation 0x181dc4c5c _CF_forwarding_prep_0
5 UIKit 0x18710f9d0 -[UISearchBar(UISearchBarStatic) _updateMagnifyingGlassView]
6 UIKit 0x18710d778 -[UISearchBar(UISearchBarStatic) _setupSearchField]
7 UIKit 0x18719d2c8 -[UISearchBar searchField]
8 UIKit 0x187114684 -[UISearchBar setPlaceholder:]
9 UIKit 0x1879c0d3c -[UISearchController _commonInit]
10 UIKit 0x1879c10cc -[UISearchController initWithSearchResultsController:]
11 EMCCountryPickerController 0x100bda6e8 -[EMCCountryPickerController loadView] (EMCCountryPickerController.m:136)
12 UIKit 0x1870208ec -[UIViewController loadViewIfRequired]
13 UIKit 0x187020844 -[UIViewController view]
14 UIKit 0x18790f450 -[_UIFullscreenPresentationController _setPresentedViewController:]
15 UIKit 0x18737cd90 -[UIPresentationController initWithPresentedViewController:presentingViewController:]
16 UIKit 0x1873a2af4 -[UIViewController _presentViewController:withAnimationController:completion:]
17 UIKit 0x1873a5890 -[UIViewController _performCoordinatedPresentOrDismiss:animated:]
18 UIKit 0x18711b3cc -[UIViewController presentViewController:animated:completion:]
19 UIKit 0x193c3084c -[UIViewControllerAccessibility presentViewController:animated:completion:]
20 bluebird-ios 0x10012e244 CountryPicker.didTapOnView() ->() (CountryPicker.swift:132)
21 bluebird-ios 0x10012e29c @objc CountryPicker.didTapOnView() ->() (CountryPicker.swift)
22 UIKit 0x1875b1f30 _UIGestureRecognizerSendTargetActions
23 UIKit 0x1871c6728 _UIGestureRecognizerSendActions
24 UIKit 0x1870537a0 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
25 UIKit 0x1875b3530 ___UIGestureRecognizerUpdate_block_invoke898
26 UIKit 0x1870124d8 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
27 UIKit 0x18700f254 _UIGestureRecognizerUpdate
28 UIKit 0x187051610 -[UIWindow _sendGesturesForEvent:]
29 UIKit 0x187050c0c -[UIWindow sendEvent:]
30 UIKit 0x18702104c -[UIApplication sendEvent:]
31 UIKit 0x193c0545c -[UIApplicationAccessibility sendEvent:]
32 UIKit 0x18701f628 _UIApplicationHandleEventQueue
33 CoreFoundation 0x181e7909c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
34 CoreFoundation 0x181e78b30 __CFRunLoopDoSources0
35 CoreFoundation 0x181e76830 __CFRunLoopRun
36 CoreFoundation 0x181da0c50 CFRunLoopRunSpecific
37 GraphicsServices 0x183688088 GSEventRunModal
38 UIKit 0x18708a088 UIApplicationMain
39 bluebird-ios 0x100225a3c main (AppDelegate.swift:13)
40 libdispatch.dylib 0x18193e8b8 (Missing)
こんにちは@Ishika、あなたの応答に感謝のデフォルトの動作を変更します場合は特に、使用時の拡張子は注意してください。しかし残念なことに、あなたの提案が私の場合にはうまくいくとは思わない。私は 'UISearchController(searchResultsController:nil)'を呼んでいる1つのことを実行するアクションにそのボタンフックをつけ、まだクラッシュの原因となっている空のビューコントローラを作成しようとしたので、 –
あなたの初期化viewDidLoad()にコードを記述し、そのコードが動作するかどうかを確認します。 – Ishika