Created
March 10, 2014 12:31
-
-
Save yingkong1987/9464193 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
- (void)loadReveal | |
{ | |
NSString *revealLibName = @"libReveal"; | |
NSString *revealLibExtension = @"dylib"; | |
NSString *dyLibPath = [[NSBundle mainBundle] pathForResource:revealLibName ofType:revealLibExtension]; | |
DLog(@"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]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment