我正在使用GMSAutocompleteViewController
,应用程序工作正常,当点击btn呈现GMSAutocompleteViewController
我正在使用 googlemaps 和Google地方时应用程序开始崩溃
我发现2.4添加了googleplacepicker
,我添加它仍然崩溃
*** 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
我从应用中删除了Google地方并开始实施它
我删除了我的风格,我也尝试使用它显示GMSPlacePickerViewController
,但是如果我点击搜索按钮就会崩溃。
在将pod更新到2.4后,所有tis都开始了,我试图回滚到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 :(得分:0)
错误信息非常清楚。
[__NSArrayM objectAtIndex:]: index 0 beyond bounds for
empty array
您现在正在使用空数组。尝试找到你使用数组的位置,并使其不是零。我认为你没有alloc
。
答案 1 :(得分:0)
问题是IQKeyboardManager
答案 2 :(得分:0)
您不得致电GMSPlacesClient.provideAPIKey