Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Error rendering macro 'navitabs' : com.atlassian.renderer.v2.macro.MacroException: The root page with the name 'Location Marketing SDK (iOS)' does not exist in space with key 'DD'!

Version 2.3.0 BETA (use PWMapKit v2.2.0 for production)

This is Phunware's iOS SDK for the Mapping module. Visit http://maas.phunware.com/ for more details and to sign up.

PWMapKit is a comprehensive indoor mapping and wayfinding SDK that allows easy integration with Phunware's indoor maps and location-based services.

Requirements

  • MaaS Core v1.3.0 or greater
  • iOS 7.0 or greater
  • Xcode 6 or greater

Installation

PWMapKit has a dependency on MaaSCore.framework (available here: Advertising SDK Integration Guide (Android)) and PWLocation.framework (available here: Advertising SDK Integration Guide (Android)).

It's recommended that you add the MaaS frameworks to the Vendor/Phunware directory, then add the MaaSCore.framework and PWMapKit.framework to your Xcode project.

The following frameworks are required:

MaaSCore.framework 
PWLocation.framework

Alternatively, you can install PWMapKit using CocoaPods:

// Add this to your Podfile 
pod PWMapKit

Scroll down for implementation details.

Documentation

PWMapKit documentation is included in the the repository's Documents folder as both HTML and as a .docset. You can also find the latest documentation here: Advertising SDK Integration Guide (Android)

Sample Application

PWMapKit comes with a ready-to-use sample application. However, you will need to update the application with your MaaS credentials and location provider information.

  1. Update your MaaS credentials and set up the building identifier in PWMapKitSampleInfo.plist.
  2. Update the localtion provider initializers in PWViewController.m.

Integration

The primary methods and objects in PWMapKit revolve around creating a map view, displaying annotations, displaying a user's location and navigation.

Adding Indoor Maps to a Map View

	// Replace all references of MKMapView with PWMapView.
    PWMapView *mapView = [[PWMapView alloc] initWithFrame:self.view.bounds];
    mapView.delegate = self;
    
    [self.view addSubview:mapView];
    
    // Load a building.
    [mapView loadBuilding:BUILDING_ID];
    
    // That's it! 

Indoor Location

PWMapKit implements an abstract indoor location manager protocol very similar to CLLocationManager, which can be implemented to provide indoor location. PWMSELocationManager implements this protocol to provide Wi-Fi-based indoor location information.

	CLLocationCoordinate2D here;
    PWMSELocationManager *locationManager = [[PWMSELocationManager alloc] initWithVenueGUID:@"VENUE GUID" location:here];
    locationManager.delegate = self;
    
    [locationManager startUpdatingLocation]; 

Routing

The indoor routing APIs have been structured to mirror MKMapKit's routing methods. The three main routing classes are PWDirectionsRequest, PWDirections and PWDirectionsResponse. Please see the API documentation and examples below for additional detail.

Routing Between Points of Interest

	// To fetch a route between two points of interest, call the following method:
    id<PWAnnotation> start, end;
    
    PWDirectionsRequest *request = [[PWDirectionsRequest alloc] initWithSource:start
                                                                   destination:end
                                                                          type:PWDirectionsTypeAny];
    
    PWDirections *directions = [[PWDirections alloc] initWithRequest:request];
    
    __weak __typeof(self)weakSelf = self;
    
    [directions calculateDirectionsWithCompletionHandler:^(PWDirectionsResponse *response, NSError *error) {
        if (!error)
        {
            [weakSelf.mapView plotRoute:response.routes.firstObject];
        }
    }];
    
    // Once you're done with the route, you can remove it from the map:
    [mapView cancelRouting]; 

Routing from a Location to a Point of Interest

	// To fetch a route between two points of interest, call the following method:
    id<PWAnnotation> end;
    id <PWLocation> location;
    
    PWDirectionsRequest *request = [[PWDirectionsRequest alloc] initWithLocation:location
                                                                     destination:end
                                                                            type:PWDirectionsTypeAny];
    
    PWDirections *directions = [[PWDirections alloc] initWithRequest:request];
    
    __weak __typeof(self)weakSelf = self;
    
    [directions calculateDirectionsWithCompletionHandler:^(PWDirectionsResponse *response, NSError *error) {
        if (!error)
        {
            [weakSelf.mapView plotRoute:response.routes.firstObject];
        }
    }];
    
    // Once you're done with the route, you can remove it from the map:
    [mapView cancelRouting]; 

Attribution

PWMapKit uses the following third-party components. All components are prefixed so you don't have to worry about namespace collisions.

ComponentDescriptionLicense
SVPulsingAnnotationViewA customizable MKUserLocationView replica for your iOS app.MIT

ON THIS PAGE

  • No labels