summaryrefslogtreecommitdiff
path: root/platform/ios/src
diff options
context:
space:
mode:
authorJason Wray <friedbunny@users.noreply.github.com>2018-08-09 13:35:28 -0400
committerGitHub <noreply@github.com>2018-08-09 13:35:28 -0400
commitec7b920603299f66332df3b324ed481c732b3657 (patch)
tree4561cda90d0a1a75f84f72f3a077a6e6b954c92b /platform/ios/src
parenta378d6fc9b71d5a40750158c5f7c475669408052 (diff)
downloadqtlocation-mapboxgl-ec7b920603299f66332df3b324ed481c732b3657.tar.gz
[ios] Standardize exception definitions
Diffstat (limited to 'platform/ios/src')
-rw-r--r--platform/ios/src/MGLMapView.h4
-rw-r--r--platform/ios/src/MGLMapView.mm17
2 files changed, 15 insertions, 6 deletions
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 44d7ab9708..20bfeeef39 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -97,6 +97,10 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLMapViewPreferredFramesPerSecond MGLMapView
/** The maximum supported frame rate; typically 60 FPS. */
FOUNDATION_EXTERN MGL_EXPORT const MGLMapViewPreferredFramesPerSecond MGLMapViewPreferredFramesPerSecondMaximum;
+FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLMissingLocationServicesUsageDescriptionException;
+FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLUserLocationAnnotationTypeException;
+FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLResourceNotFoundException;
+
/**
An interactive, customizable map view with an interface similar to the one
provided by Apple’s MapKit.
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index fa0beb008d..7423c23c7b 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -92,6 +92,10 @@ const MGLMapViewPreferredFramesPerSecond MGLMapViewPreferredFramesPerSecondDefau
const MGLMapViewPreferredFramesPerSecond MGLMapViewPreferredFramesPerSecondLowPower = 30;
const MGLMapViewPreferredFramesPerSecond MGLMapViewPreferredFramesPerSecondMaximum = 60;
+const MGLExceptionName MGLMissingLocationServicesUsageDescriptionException = @"MGLMissingLocationServicesUsageDescriptionException";
+const MGLExceptionName MGLUserLocationAnnotationTypeException = @"MGLUserLocationAnnotationTypeException";
+const MGLExceptionName MGLResourceNotFoundException = @"MGLResourceNotFoundException";
+
/// Indicates the manner in which the map view is tracking the user location.
typedef NS_ENUM(NSUInteger, MGLUserTrackingState) {
/// The map view is not yet tracking the user location.
@@ -138,7 +142,7 @@ static NSString * const MGLInvisibleStyleMarkerSymbolName = @"invisible_marker";
/// Prefix that denotes a sprite installed by MGLMapView, to avoid collisions
/// with style-defined sprites.
-NSString *const MGLAnnotationSpritePrefix = @"com.mapbox.sprites.";
+NSString * const MGLAnnotationSpritePrefix = @"com.mapbox.sprites.";
/// Slop area around the hit testing point, allowing for imprecise annotation selection.
const CGFloat MGLAnnotationImagePaddingForHitTest = 5;
@@ -4790,7 +4794,8 @@ public:
NSString *suggestedUsageKeys = requiresWhenInUseUsageDescription ?
@"NSLocationWhenInUseUsageDescription and (optionally) NSLocationAlwaysAndWhenInUseUsageDescription" :
@"NSLocationWhenInUseUsageDescription and/or NSLocationAlwaysUsageDescription";
- [NSException raise:@"Missing Location Services usage description" format:@"This app must have a value for %@ in its Info.plist.", suggestedUsageKeys];
+ [NSException raise:MGLMissingLocationServicesUsageDescriptionException
+ format:@"This app must have a value for %@ in its Info.plist.", suggestedUsageKeys];
}
}
@@ -4827,7 +4832,7 @@ public:
userLocationAnnotationView = (MGLUserLocationAnnotationView *)[self.delegate mapView:self viewForAnnotation:self.userLocation];
if (userLocationAnnotationView && ! [userLocationAnnotationView isKindOfClass:MGLUserLocationAnnotationView.class])
{
- [NSException raise:@"MGLUserLocationAnnotationTypeException"
+ [NSException raise:MGLUserLocationAnnotationTypeException
format:@"User location annotation view must be a kind of MGLUserLocationAnnotationView. %@", userLocationAnnotationView.debugDescription];
}
}
@@ -6007,7 +6012,7 @@ public:
if ( ! image)
{
- [NSException raise:@"MGLResourceNotFoundException" format:
+ [NSException raise:MGLResourceNotFoundException format:
@"The resource named “%@” could not be found in the Mapbox framework bundle.", imageName];
}
@@ -6296,8 +6301,8 @@ private:
NSURL *url = URLString.length ? [NSURL URLWithString:URLString] : nil;
if (URLString.length && !url)
{
- [NSException raise:@"Invalid style URL" format:
- @"“%@” is not a valid style URL.", URLString];
+ [NSException raise:MGLInvalidStyleURLException
+ format:@"“%@” is not a valid style URL.", URLString];
}
self.styleURL = url;
}