Supports
#import "AHDirectionsObject.h"
In your .m file add
AHDirectionsObject *directions = [[AHDirectionsObject alloc] init];Apple has updated its security significantly in iOS 9, which means you need to declare all URL Schemers otherwise 3rd party applications will not open.
To declare all scemers you must add LSApplicationQueriesSchemes
in your project .plst file, like so...
<key>LSApplicationQueriesSchemes</key>
<array>
<string>citymapper</string><br/>
<string>comgooglemaps</string><br/>
<string>waze</string><br/>
</array>
For more information on these changes see this video from WWDC 2015
To return a list (NSArray) of the available (installed) map services on the users device simple call...[directions directionsApplications];
To open a specifyed application call the directionsHandle
. This method has two parameters - the location (CLLocation
) and the type of application (NSString
)
[directions directionsHandle:[[CLLocation alloc] initWithLatitude:YOUR_LATITUDE_FLOAT longitude:YOUR_LONGITUDE_FLOAT] type:@"citymapper"];
They type key accepts...
Or, set as nil
to open the native Apple Maps.
type
is passed which is not available the class will revert to Apple Maps