Skip to content

Instantly share code, notes, and snippets.

@daniel-beard
Last active August 29, 2015 14:25
Show Gist options
  • Save daniel-beard/8238e12afd926a234813 to your computer and use it in GitHub Desktop.
Save daniel-beard/8238e12afd926a234813 to your computer and use it in GitHub Desktop.
SEL selector = NSSelectorFromString(@"setAuthorizationStatus:forBundleIdentifier:");
NSMethodSignature *methodSignature = [CLLocationManager methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
invocation.selector = selector;
CLAuthorizationStatus status = kCLAuthorizationStatusAuthorizedAlways;
NSString *identifier = @"com.test.testapp";
[invocation setArgument:&status atIndex:2];
[invocation setArgument:&identifier atIndex:3];
[invocation invokeWithTarget:[CLLocationManager class]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment