Skip to content

Instantly share code, notes, and snippets.

@rraallvv
Last active August 29, 2015 14:20
Show Gist options
  • Save rraallvv/950f58abc232394683ea to your computer and use it in GitHub Desktop.
Save rraallvv/950f58abc232394683ea to your computer and use it in GitHub Desktop.
[ObjC] Get class/instance from bundle
NSString *frameworksPath = @"/System/Library/Frameworks";
NSBundle *bundle = [NSBundle bundleWithPath:[frameworksPath stringByAppendingPathComponent:@"AVKit.framework"]];
void* handle = dlopen(bundle.executablePath.UTF8String, RTLD_NOW);
dlclose(handle);
Class class = NSClassFromString(@"AVPlayerView");
id instance = [[class alloc] init];
NSLog(@"%@ %@", class, instance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment