Mapping SDK 3.0 Integration Guide (iOS)
Mapping Setup and Prerequisites
iOS Managed Provider Setup
- Phunware recommends using CocoaPods to integrate the framework. Simply add
pod 'PWMapKit'to your podfile.
- Alternatively, all of the following frameworks can be added to the Vendor/Phunware directory of your project:
- Initialize Cocoapods if your project does not already use it. If your environment does not already have Cocoapods installed, enter "sudo gem install cocoapods" in Terminal. After Cocoapods is installed, navigate to your project's root directory in the Terminal. Enter "pod init" in Terminal.
- In the Podfile file that is generated, modify the text in Xcode or your preferred text editor. Add the line "pod 'PWMapKit'" after the "target" line and before the "end" line. Save the file.
- Enter "pod install" in Terminal while in the directory that contains the Podfile.
- Use the .xcworkspace file that was generated by the pod install from now on.
- In your project's Info.plist file, add a row with key: "Privacy - Location When In Use Usage Description" (Xcode should autocomplete this) and for value, add what you want your users to see when prompted for Location use by the device.
The framework comes with a ready-to-use sample application. In order to use this application you will need to update the configuration with your MaaS credentials and location provider information.
- Update your MaaS credentials and set up the building identifier in
Register Location Provider
Routing for iOS Mapping
Current Route Updates
Displaying your Map
Showing Current Location on the Map
This will display your current location on your building map if the MaaS and hardware were also configured properly. If you encounter issues, create the PWManagedLocationManager as a property and assign its delegate to your view controller rather than calling registerLocationManager on the PWMapView. The error may then be captured with the PWLocationManagerDelegate callback function "- (void)locationManager:(id<PWLocationManager>)manager failedWithError:(NSError *)error;"