Check if push enabled or location enabled ios sdk -


i'm using following code detect these 2 (push notifications , location services)

    [postvars setobject:([cllocationmanager locationservicesenabled])?@"true":@"false" forkey:@"locationservicesenabled"];      bool pushenabled = [[uiapplication sharedapplication] isregisteredforremotenotifications];     [postvars setobject:(pushenabled)?@"true":@"false" forkey:@"pushservicesenabled"]; 

but issue i'm getting true both if tap don't allow when prompted in app. in settings app checked location set never , notifications subheading shows off. what's wrong code ? can guide me in this.

just checking [cllocationmanager locationservicesenabled] not enough.

if([cllocationmanager locationservicesenabled] &&     [cllocationmanager authorizationstatus] != kclauthorizationstatusdenied) {     [postvars setobject:@"true" forkey:@"locationservicesenabled"];  } 

for notifications check awesome so answer

bool pushenabled = [[uiapplication sharedapplication] isregisteredforremotenotifications]; [postvars setobject:(pushenabled)?@"true":@"false" forkey:@"pushservicesenabled"];  uiremotenotificationtype types = [[uiapplication sharedapplication] enabledremotenotificationtypes]; if (types == uiremotenotificationtypenone)     {     [postvars setobject:@"false" forkey:@"pushservicesenabled"]; } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -