PWMapKit SDK for iOS
这是 Phunware 为其 Multiscreen-as-a-Service 平台使用的 Mapping SDK。它是一个室内/室外全面地图和导航解决方案,可轻松集成 Phunware 的地图和基于位置的服务。访问 http://maas.phunware.com 了解更多详情并注册。
要求
- PWLocation 3.13.x
- PWCore 3.12.x
- iOS 13.0 或更高版本
- Xcode 13 或更高版本
安装
CocoaPods
集成框架需要使用CocoaPods 1.10或更高版本。只需将以下内容添加到您的Podfile中:
pod 'PWMapKit'
文档
文档包括HTML和.docset格式,保存在代码库的Documents文件夹中。您也可以在这里找到最新文档: http://phunware.github.io/maas-mapping-ios-sdk
使用
PWMapKit组件的主要用途是创建地图视图、显示兴趣点、显示用户位置和室内导航。
设置
在开始地图集成之前,请确保您的应用设置正确: 设置
位置权限
若使 PWLocationManager 正常工作,需要设置“使用中”或“始终”的位置授权。请参考Apple 最佳实践以请求位置权限。如果用户未提供位置授权,请勿尝试使用 PWLocationManager,因为这可能会导致不可预料的行为。
添加地图视图
// Load a building
PWBuilding.building(withIdentifier: <BUILDING_IDENTIFIER>) { (building, error) in
// Get the buliding object here
}
...
// Show the building on the map
let mapView = PWMapView(frame: <FRAME>)
mapView.delegate = self
self.view.addSubview(mapView)
map.setBuilding(<BUILDING>, animated: <ANIMATED>) { (error) in
// Building should be on the map
}
注册位置提供者
在 PWMapView 中注册位置提供者后,可以在地图上显示用户位置。位置提供者在 PWLocation 框架中(参见https://github.com/phunware/maas-location-ios-sdk观看不同提供选项的设置示例)。一旦位置提供者初始化,可以使用以下调用将提供者注册到 PWMapView
mapView.register(<MANAGER_OBJECT>)
注意:如果使用 Mist 或 Beacon Point 这样的虚拟信标提供者,必须在项目设置的能力标签中启用“使用蓝牙低功耗附件”的后台模式。
路线规划
let routeOptions = PWRouteOptions(accessibilityEnabled: false,
landmarksEnabled: false,
excludedPointIdentifiers: nil)
PWRoute.createRoute(from: <START_POINT>,
to: <END_POINT>,
options: routeOptions) { (route, error) in
// Plot the route on the map
mapView.navigate(with: route)
}
归属
PWMapKit 使用以下第三方依赖关系:
组件 | 描述 | 许可证 |
---|---|---|
SVPulsingAnnotationView | 为您的 iOS 应用定制的一个 MKUserLocationView 替代方案。 | MIT |
TMCache | 适用于 iOS 和 OS X 的快速并行对象缓存。 | Apache 2.0 |
隐私
您理解并同意在 www.phunware.com/privacy 的 Phunware 隐私政策。如果您的 Phunware 软件使用需要自己的隐私政策,您也同意将 Phunware 隐私政策的条款纳入您向最终用户提供的隐私政策中。
条款
使用此软件需要审查和接受我们位于 http://www.phunware.com/terms 的开发者使用条款。