ios - CoreData:注释:无法在路径“Users/~/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo”加载优化模型
问题描述
在我的 iOS 应用程序中打开加载地图视图时出现错误。地图视图加载正常并出现在屏幕上,但是它没有加载到我在初始化地图视图时设置的位置。
这是我用来实现地图视图的代码:
@IBOUTLET weak var mapView: UIView!
override viewDidLoad() {
let camera = GMSCameraPosition.camera(withLatitude: lat!, longitude: long!, zoom: 10)
mapView = GMSMapView.map(withFrame: mapView.frame, camera: camera)
}
每当应用程序使用地图视图加载视图控制器时,就会出现这种情况:
CoreData: annotation: Failed to load optimized model at path '/Users/johnrendleman/Library/Developer/CoreSimulator/Devices/D9D3A943-E0B4-4DE2-8120-A6E9AE3B3F88/data/Containers/Bundle/Application/934980AB-F8E4-4214-8435-9E684AF58C87/ChapelHillTransit.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
CoreData: annotation: Failed to load optimized model at path '/Users/johnrendleman/Library/Developer/CoreSimulator/Devices/D9D3A943-E0B4-4DE2-8120-A6E9AE3B3F88/data/Containers/Bundle/Application/934980AB-F8E4-4214-8435-9E684AF58C87/ChapelHillTransit.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
CoreData: annotation: Failed to load optimized model at path '/Users/johnrendleman/Library/Developer/CoreSimulator/Devices/D9D3A943-E0B4-4DE2-8120-A6E9AE3B3F88/data/Containers/Bundle/Application/934980AB-F8E4-4214-8435-9E684AF58C87/ChapelHillTransit.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'
我已经尝试过的事情:
- 干净的构建。
- 更新 pod repo 和 pod(适用于 iOS 2.7.3 的 Google Maps & Places API
- 更新 XCode (9.4.1)
- 使用适当的包标识符限制重新生成 API 密钥
- 确保在 Google Developer Console 上启用了我的 API
有人知道修复吗?
解决方案
我刚刚花了 5 个小时来解决同样的问题。有时地图会显示,有时则不会。最后,我发现我的钥匙有问题。我不小心删除了它对 iOS 的权限。一些模拟器正在显示地图,因为它们缓存了密钥。还有一些人正在显示“StorageWithTileProto”错误,因为他们使用旧密钥缓存了切片,但没有授权显示它。我建议使用“StorageWithTileProto”的任何人使用新的不受限制的密钥对其进行测试,并在测试之前从设备/模拟器中完全删除该应用程序。这也可能解决您的问题。
推荐阅读
- rust - 如何在 Rust 中使用 Mutex 创建临界区?
- angular - 如何处理空值?
- kubernetes - 如何在 kubernetes 中使用 postgres 数据库设置 Keycloak
- vb.net - VB中的CRC64计算
- javascript - 使用jquery从下拉列表中选择值时如何分配值和禁用框
- python - 如何在文本文档中使用 python 将数字与文本转换?
- javascript - 状态没有更新?
- scala - Spark:按给定年份列表汇总值
- google-cloud-platform - Google Cloud AI Platform 训练作业:--stream-logs 无限期停止,没有输出
- python - 在数组中搜索一个值,然后从其他相同长度的数组/ndarray 中打印相应的值