My company develops an advertising SDK that mediates other ad networks. At runtime, it checks if the other ad networks are present by using NSClassFromString
, a
You can use CFBundleGetDataPointerForName
to lookup a constant's value at runtime
NSString *lookupStringConstant(NSString *constantName) {
void ** dataPtr = CFBundleGetDataPointerForName(CFBundleGetMainBundle(), (__bridge CFStringRef)constantName);
return (__bridge NSString *)(dataPtr ? *dataPtr : nil);
}
Example use:
NSString *version = lookupStringConstant(@"VungleSDKVersion");
NSLog(@"Version = %@",version);