2017-08-26 79 views
0

我使用GMSAutocompleteViewController後,該應用程序工作正常,突然啓動的應用程序崩潰時,點擊BTN呈現GMSAutocompleteViewController我使用的GoogleMaps和谷歌的地方 我發現,2.4加入googleplacepicker它,我增加它仍然崩潰GMSAutocompleteViewController崩潰目前

*** Terminating app due to uncaught exception 'NSRangeException', 
reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for 
empty array' 
*** First throw call stack: 
(0x192b5efe0 0x1915c0538 0x192a3d200 0x101ceffe0 0x101cebdd0 
0x192af95f4 0x192af8d08 0x192af8a84 0x192b677a8 0x192a3c95c 
0x19354f970 0x198d96a9c 0x198e7ed90 0x198e81bd8 0x198ece9b4 
0x198e7ef60 0x198d140c0 0x198d14504 0x198d95478 0x1991aea00 
0x1006ddd54 0x198ca8838 0x198ca85a8 0x198d4809c 0x198d47870 
0x198d47424 0x198d47388 0x198c8dcc0 0x195e7e274 0x195e72de8 
0x195e72ca8 0x195dee34c 0x195e153ac 0x195e15e78 0x192b0c9a8 
0x192b0a630 0x192b0aa7c 0x192a3ada4 0x1944a5074 0x198cf5c9c 
0x1000b2714 0x191a4959c) 
libc++abi.dylib: terminating with uncaught exception of type 
NSException 

我刪除從應用程序的谷歌的地方,並開始阿恩實施它
我刪除我的風格,我還試圖用GMSPlacePickerViewController它提出的,但如果我點擊搜索按鈕,它崩潰一樣 。 所有那朵更新莢2.4後開始,我試圖回滾到2.3.1,但仍崩潰
我不會傳遞任何數組對象

let autocompleteController = GMSAutocompleteViewController() 
    autocompleteController.delegate = self 
    present(autocompleteController, animated: true, completion: nil) 

我運行結束一個新的項目和移動代碼,它 這裏是callStack:

`2017-08-29 21:41:25.133 Client[16513:1632140] *** Terminating app due 
to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM 
objectAtIndex:]: index 0 beyond bounds for empty array' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000010b9d6b0b 
    __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010b2a8141 
    objc_exception_throw + 48 
    2 CoreFoundation      0x000000010b90bffb - 
    [__NSArrayM objectAtIndex:] + 203 
    3 IQKeyboardManager     0x000000010804bfe3 - 
    [IQKeyboardManager addToolbarIfRequired] + 3539 
    4 IQKeyboardManager     0x0000000108047642 - 
    [IQKeyboardManager textFieldViewDidBeginEditing:] + 1234 
    5 CoreFoundation      0x000000010b975c2c _ . 
_CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 
    6 CoreFoundation      0x000000010b975b29 
    _CFXRegistrationPost + 425 
    7 CoreFoundation      0x000000010b975892 
    ___CFXNotificationPost_block_invoke + 50 
    8 CoreFoundation      0x000000010b939102 - 
    [_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826 
    9 CoreFoundation      0x000000010b938261 
    _CFXNotificationPost + 673 
    10 Foundation       0x0000000107a91ca4 - 
    [NSNotificationCenter postNotificationName:object:userInfo:] + 66 
    11 UIKit        0x000000010a1cf913 - 
    [UITextField _becomeFirstResponder] + 692 
    12 UIKit        0x0000000109afeb0d - 
    [UISearchBarTextField _becomeFirstResponder] + 94 
     13 UIKit        0x000000010a1cf4f5 - 
    [UITextField __resumeBecomeFirstResponder] + 52 
    14 UIKit        0x0000000109afee72 __45- 
    [UISearchBarTextField _becomeFirstResponder]_block_invoke + 381 
    15 UIKit        0x0000000109afecf3 - 
    [UISearchBarTextField _becomeFirstResponder] + 580 
    16 UIKit        0x00000001098e6171 - 
     [UIResponder becomeFirstResponder] + 436 
     17 UIKit        0x000000010977f647 - 
    [UIView(Hierarchy) becomeFirstResponder] + 137 
    18 UIKit        0x000000010a1ce8c6 - 
    [UITextField becomeFirstResponder] + 50 
    19 UIKit        0x0000000109afb9cc - 
    [UISearchBar(UISearchBarStatic) becomeFirstResponder] + 48 
    20 Client        0x0000000104939085 - 
    [GMSAutocompleteContentViewController viewWillAppear:] + 159 
    21 UIKit        0x0000000109878bad - 
    [UIViewController _setViewAppearState:isAnimating:] + 447 
    22 UIKit        0x00000001098793c3 - 
    [UIViewController __viewWillAppear:] + 147` 
+0

您試圖傳遞一個空數組。你能不能更多地發佈你的代碼,以便我們可以嘗試解決它。 – Rex

+0

我不會傳遞任何陣列到'GMSAutocompleteViewController'這裏是所有代碼我使用'倍率FUNC viewDidLoad中(){ super.viewDidLoad() 讓autocompleteController = GMSAutocompleteViewController() autocompleteController.delegate =自 本(autocompleteController ,animated:true,completion:nil)}'這是空的viewController,之後。很多調試和嘗試。在'GMSAutocompleteViewController'內輸入'UISearchBar'中的第一個字符後發生崩潰。 – Bassem

+0

你是否啓用了斷點?崩潰後顯示哪條線? – Shmidt

回答

0

問題是IQKeyboardManager

0

錯誤信息非常清楚。您正在使用空數組。嘗試找到你使用數組的地方,並使其不爲零。我想你沒有alloc吧。

+0

它沒有傳遞任何數組,它唯一改變的就是使用UIApperance完成造型和造型。 – Bassem

+0

嘗試查找其他部分是否使用數組,可能與'''GMSAutocompleteViewController'''無關,也會清理項目重新構建。 –

+0

我創建了空的'ViewControlle'r並測試'GMSAutocompleteViewController'它崩潰了,我創建了一個'UIsearchbar'並添加了結果控制器,它在輸入搜索欄的第一個字母后崩潰,我創建了'GMSPlacePickerViewController'它包含'GMSAutocompleteViewController'像谷歌示例,我崩潰時,我按搜索UIBarButton – Bassem