Using bundleForClass for retrieving bundle of framework where i have defined a class.
NSBundle *bundle = [NSBundle **bundleForClass**: [self class]]; // Class in framework
NSString *readtext = [bundle **pathForResource**:@"Test" ofType:@"rtf"];
Getting appbundle of application(Where i am using my framework) instead of framework bundle.
How to get framework bundle path and read the framework resources.
You can load NSBundle with Bundle Identifier of framework:
[NSBundle bundleWithIdentifier:YOUR_FRAMEWORK_BUNDLE_IDENTIFIRE];
If the framework has a resources bundle in it, then you can access the resources by:
NSBundle *bundle = [NSBundle bundleForClass:[YOUR_CLASS_NAME class]];
NSURL *url = [bundle URLForResource:RESOURCE_BUNDLE_NAME withExtension:@"bundle"];
NSBundle *resourceBundle = [NSBundle bundleWithURL:url];
UIImage* infoImage = [UIImage imageWithContentsOfFile:[resourceBundle pathForResource:@"info" ofType:@"png"]];