summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-05-16 20:26:28 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-05-16 20:26:28 -0700
commit563fed5ca93273342366c54be8f619c12b514417 (patch)
treebf7052c3835e9d0f13984a4c0ecd994e397c7b4a
parent9ceda19363848d18db3aaf3edcbbada7dc96dd05 (diff)
downloadqtlocation-mapboxgl-563fed5ca93273342366c54be8f619c12b514417.tar.gz
Properly fail to load the map
A typo in a selector literal meant that `-[MGLMapViewDelegate mapViewDidFailLoadingMap:withError:]` would never be sent to delegates even if `MGLMapView` had called it. Along for the ride, create a proper `NSError` to pass into that callback, and an error domain for that error.
-rw-r--r--gyp/platform-ios.gypi1
-rw-r--r--include/mbgl/ios/MGLTypes.h2
-rw-r--r--platform/ios/MGLMapView.mm5
-rw-r--r--platform/ios/MGLTypes.m3
4 files changed, 9 insertions, 2 deletions
diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi
index 7e91648c40..0e200f5e1d 100644
--- a/gyp/platform-ios.gypi
+++ b/gyp/platform-ios.gypi
@@ -35,6 +35,7 @@
'../platform/ios/MGLUserLocationAnnotationView.h',
'../platform/ios/MGLUserLocationAnnotationView.m',
'../include/mbgl/ios/MGLTypes.h',
+ '../platform/ios/MGLTypes.m',
'../platform/ios/NSBundle+MGLAdditions.h',
'../platform/ios/NSBundle+MGLAdditions.m',
'../platform/ios/NSException+MGLAdditions.h',
diff --git a/include/mbgl/ios/MGLTypes.h b/include/mbgl/ios/MGLTypes.h
index 9a393b2fd4..d4bc6c2ce2 100644
--- a/include/mbgl/ios/MGLTypes.h
+++ b/include/mbgl/ios/MGLTypes.h
@@ -1,5 +1,7 @@
#import <Foundation/Foundation.h>
+extern NSString * const MGLErrorDomain;
+
/** The mode used to track the user location on the map. */
typedef NS_ENUM(NSUInteger, MGLUserTrackingMode)
{
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index ff31ec9e1a..dfbb034398 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -2352,9 +2352,10 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng)
}
case mbgl::MapChangeDidFailLoadingMap:
{
- if ([self.delegate respondsToSelector:@selector(mapViewDidFailLoadingMap:withError::)])
+ if ([self.delegate respondsToSelector:@selector(mapViewDidFailLoadingMap:withError:)])
{
- [self.delegate mapViewDidFailLoadingMap:self withError:nil];
+ NSError *error = [NSError errorWithDomain:MGLErrorDomain code:0 userInfo:nil];
+ [self.delegate mapViewDidFailLoadingMap:self withError:error];
}
break;
}
diff --git a/platform/ios/MGLTypes.m b/platform/ios/MGLTypes.m
new file mode 100644
index 0000000000..01e9a1467c
--- /dev/null
+++ b/platform/ios/MGLTypes.m
@@ -0,0 +1,3 @@
+#import "MGLTypes.h"
+
+NSString * const MGLErrorDomain = @"MGLErrorDomain";