我的模拟器中的 Place Picker 有问题。它正在崩溃
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c15dd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010bbbf21e objc_exception_throw + 48
2 CoreFoundation 0x000000010c07415f -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 351
3 CoreFoundation 0x000000010c073fcb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
4 myApp 0x0000000106f64c58 -[GMSPlatformKeyInsertingPlacesServerClient setPlacesService:] + 376
5 myApp 0x0000000106f64ac6 -[GMSPlatformKeyInsertingPlacesServerClient placesService] + 104
6 myApp 0x0000000106f64163 -[GMSPlatformKeyInsertingPlacesServerClient executeQuery:completionHandler:] + 88
7 myApp 0x0000000106f639f3 -[GMSPlacesServerClient accountPlacePickerSessionWithRequestSource:callback:] + 343
8 myApp 0x0000000106f88d60 -[GMSPlacesClient accountPlacePickerSessionWithCallback:] + 147
9 myApp 0x0000000106f58564 -[GMSPlacePicker pickPlaceWithResultCallback:didDisappearCallback:] + 887
10 myApp 0x0000000106b12273 _TFC6Medico11NewAdressVC13chooseAddressfT_T_ + 259
11 myApp 0x0000000106b11449 _TFC6Medico11NewAdressVC11viewDidLoadfT_T_ + 985
12 myApp 0x0000000106b12152 _TToFC6Medico11NewAdressVC11viewDidLoadfT_T_ + 34
13 UIKit 0x0000000109c11a3d -[UIViewController loadViewIfRequired] + 1258
14 UIKit 0x0000000109c18062 -[UIViewController __viewWillAppear:] + 118
15 UIKit 0x0000000109c431d3 -[UINavigationController _startCustomTransition:] + 1290
16 UIKit 0x0000000109c53e48 -[UINavigationController _startDeferredTransitionIfNeeded:] + 697
17 UIKit 0x0000000109c54fdb -[UINavigationController __viewWillLayoutSubviews] + 58
18 UIKit 0x0000000109e4bdd7 -[UILayoutContainerView layoutSubviews] + 223
19 UIKit 0x0000000109b34ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
20 QuartzCore 0x0000000109686bf8 -[CALayer layoutSublayers] + 146
21 QuartzCore 0x000000010967a440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
22 QuartzCore 0x000000010967a2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
23 QuartzCore 0x0000000109608318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
24 QuartzCore 0x00000001096353ff _ZN2CA11Transaction6commitEv + 475
25 QuartzCore 0x0000000109635d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
26 CoreFoundation 0x000000010c102267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
27 CoreFoundation 0x000000010c1021d7 __CFRunLoopDoObservers + 391
28 CoreFoundation 0x000000010c0e6f8e __CFRunLoopRun + 1198
29 CoreFoundation 0x000000010c0e6884 CFRunLoopRunSpecific + 420
30 GraphicsServices 0x000000010ec0ea6f GSEventRunModal + 161
31 UIKit 0x0000000109a6fc68 UIApplicationMain + 159
32 myApp 0x0000000106ba8c2f main + 111
33 libdyld.dylib 0x000000010d1a468d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我不知道它为什么会崩溃,因为它昨天开始崩溃。但在设备上一切正常
这是我的代码,但即使我将此回调为空,它仍然会崩溃。我不知道该怎么办
让配置 = GMSPlacePickerConfig(视口:无) 让 placePicker = GMSPlacePicker(配置:配置)
placePicker.pickPlace(callback: { (place: GMSPlace?, error: Error?) -> Void in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
guard let place = place else {
print("No place selected")
return
}
let camera = GMSCameraPosition.camera(withLatitude: place.coordinate.latitude, longitude: place.coordinate.longitude, zoom: 18)
self.mapView.camera = camera
self.marker.position = place.coordinate
self.marker.map = self.mapView
self.marker.appearAnimation = .pop
print("#Place address \(place.formattedAddress)")
if let addr = place.formattedAddress {
self.addressString = addr
}
self.updateAddressCell(place)
self.lastSelectedPlace = place
self.saveChangesButton.isHidden = false
})