- (void)check_ios_permissions:(CDVInvokedUrlCommand*)command
{
NSString *callbackId = command.callbackId;
NSString *push=@"no";
NSString *location=@"no";
CDVPluginResult* pluginResult;
@ try {
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types & UIRemoteNotificationTypeAlert) push=@"yes";
if([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) location=@"denied";
else if(![CLLocationManager locationServicesEnabled]) location=@"disabled";
else location=@"yes";
NSDictionary *jsonObj = [ [NSDictionary alloc]
initWithObjectsAndKeys :
location, @"location",
push, @"push",
nil
];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary : jsonObj];
} @catch (NSException * e) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[e reason]];
} @finally {
[self writeJavascript:[pluginResult toSuccessCallbackString:callbackId]];
}
}typedef enum {
kCLAuthorizationStatusNotDetermined = 0,
kCLAuthorizationStatusRestricted,
kCLAuthorizationStatusDenied,
kCLAuthorizationStatusAuthorized
} CLAuthorizationStatus;
You haven't considered all of them