Safely call -[UIApplication isRegisteredForRemoteNotifications]

Fixes #1117.
This commit is contained in:
Minh Nguyễn
2015-03-26 15:44:58 -07:00
parent 00d2cbe5cb
commit 6680669716

View File

@@ -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");