Skip to content

Instantly share code, notes, and snippets.

@Seasons7
Created November 7, 2015 14:36
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 Seasons7/2eb1578e680e0a4f45c0 to your computer and use it in GitHub Desktop.
Save Seasons7/2eb1578e680e0a4f45c0 to your computer and use it in GitHub Desktop.
CCBReader.m
Class class = NSClassFromString(className);
if (!class)
{
// Class was not found. Maybe it's a Swift class?
// See http://stackoverflow.com/questions/24030814/swift-language-nsclassfromstring
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *classStringName = [NSString stringWithFormat:@"_TtC%lu%@%lu%@", (unsigned long)appName.length, appName, (unsigned long)className.length, className];
class = NSClassFromString(classStringName);
}
if (!class)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment