Skip to content

Instantly share code, notes, and snippets.

@olxios
Last active May 30, 2016 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olxios/0203d3f84efbcb8518ed41b753612e7e to your computer and use it in GitHub Desktop.
Save olxios/0203d3f84efbcb8518ed41b753612e7e to your computer and use it in GitHub Desktop.
[Private iOS API] Toggle location services programmatically: http://swiftiostutorials.com/private-ios-api-toggle-location-services-programmatically/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.locationd.authorizeapplications</key>
<true/>
</dict>
</plist>
#import "LocationToggle.h"
#import <CoreLocation/CoreLocation.h>
@interface CLLocationManager (Toggle)
+ (void)setLocationServicesEnabled:(BOOL)enabled;
@end
@implementation LocationToggle
+ (void)toggleLocationServices:(BOOL)locationServicesEnabled
{
[CLLocationManager setLocationServicesEnabled:locationServicesEnabled];
}
@end
/*
Entitlements:
com.apple.locationd.authorizeapplications is required
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment