Skip to content

Instantly share code, notes, and snippets.

@rais38
Created October 18, 2013 08:12
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 rais38/7038167 to your computer and use it in GitHub Desktop.
Save rais38/7038167 to your computer and use it in GitHub Desktop.
Reveal
#pragma mark - Reveal
#import <dlfcn.h>
- (void)startReveal
{
NSString *revealLibName = @"libReveal";
NSString *revealLibExtension = @"dylib";
NSString *dyLibPath = [[NSBundle mainBundle] pathForResource:revealLibName ofType:revealLibExtension];
NSLog(@"Loading dynamic library: %@", dyLibPath);
void *revealLib = NULL;
revealLib = dlopen([dyLibPath cStringUsingEncoding:NSUTF8StringEncoding], RTLD_NOW);
if (revealLib == NULL) {
char *error = dlerror();
NSLog(@"dlopen error: %s", error);
NSString *message = [NSString stringWithFormat:@"%@.%@ failed to load with error: %s", revealLibName, revealLibExtension, error];
[[[UIAlertView alloc] initWithTitle:@"Reveal library could not be loaded" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
} else {
// Post a notification to signal Reveal to start the service.
[[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:self];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment