diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-03-26 15:44:58 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-03-26 15:44:58 -0700 |
commit | 66806697162d44aef4fd50bf47c8ade72d5566e1 (patch) | |
tree | ead1c8fb7357ccbeb7cc19b72f23dfd326f63699 | |
parent | 00d2cbe5cbab789388d3b06b899d007b2c44e61a (diff) | |
download | qtlocation-mapboxgl-66806697162d44aef4fd50bf47c8ade72d5566e1.tar.gz |
Safely call `-[UIApplication isRegisteredForRemoteNotifications]`
Fixes #1117.
-rw-r--r-- | platform/ios/MGLMapView.mm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index a4604bc580..8b8d902994 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -365,10 +365,12 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSMutableDictionary *evt = [[NSMutableDictionary alloc] init]; - [evt setValue:[[NSNumber alloc] initWithDouble:mbglMap->getLatLng().latitude] forKey:@"lat"]; - [evt setValue:[[NSNumber alloc] initWithDouble:mbglMap->getLatLng().longitude] forKey:@"lng"]; - [evt setValue:[[NSNumber alloc] initWithDouble:mbglMap->getZoom()] forKey:@"zoom"]; - [evt setValue:[[NSNumber alloc] initWithBool:[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]] forKey:@"enabled.push"]; + [evt setValue:@(mbglMap->getLatLng().latitude) forKey:@"lat"]; + [evt setValue:@(mbglMap->getLatLng().longitude) forKey:@"lng"]; + [evt setValue:@(mbglMap->getZoom()) forKey:@"zoom"]; + BOOL isRegisteredForRemoteNotifications = ([[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)] + && [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]); + [evt setValue:@(isRegisteredForRemoteNotifications) forKey:@"enabled.push"]; NSString *email = @"Unknown"; Class MFMailComposeViewController = NSClassFromString(@"MFMailComposeViewController"); |