Created
October 18, 2013 08:12
-
-
Save rais38/7038167 to your computer and use it in GitHub Desktop.
Reveal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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