diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2018-08-09 13:35:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 13:35:28 -0400 |
commit | ec7b920603299f66332df3b324ed481c732b3657 (patch) | |
tree | 4561cda90d0a1a75f84f72f3a077a6e6b954c92b /platform/ios | |
parent | a378d6fc9b71d5a40750158c5f7c475669408052 (diff) | |
download | qtlocation-mapboxgl-ec7b920603299f66332df3b324ed481c732b3657.tar.gz |
[ios] Standardize exception definitions
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.h | 4 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 17 |
3 files changed, 16 insertions, 6 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index a904d15835..303d8160bf 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ## master * Improved the Swift interface for `MGLMapView.decelerationRate`. ([#12584](https://github.com/mapbox/mapbox-gl-native/issues/12584)) +* Fixed inconsistencies in exception naming. ([#12583](https://github.com/mapbox/mapbox-gl-native/issues/12583)) ## 4.3.0 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; } |