我正在使用GMSAutocompleteViewController
,该应用程序运行正常,突然单击BTN显示应用程序开始崩溃GMSAutocompleteViewController
我正在使用谷歌地图和谷歌地点 我发现添加了2.4googleplacepicker
,我添加了它,但仍然崩溃
*** 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
但如果我单击搜索按钮,它会崩溃同样. 所有 tis 在将 pods 更新到 2.4 后启动,我试图回滚到 2.3.1 但仍然崩溃
我没有将任何数组传递给对象
let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
present(autocompleteController, animated: true, completion: nil)
我打开了一个新项目并将代码移动到其中 这是调用堆栈:
`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`
错误消息非常清楚。
[__NSArrayM objectAtIndex:]: index 0 beyond bounds for
empty array
您现在正在使用一个空数组。尝试找到您使用数组的位置并使其不为零。我想你没有alloc
它。
您不能调用 GMSPlacesClient.provideAPIKey
问题是IQKeyboardManager。