bundleWithPath:
Returns an
NSBundle
object that corresponds to the specified directory.
+ (NSBundle *)bundleWithPath:(NSString *)fullPath
Parameters
- fullPath
- The path to a directory. This must be a full pathname for a directory; if it contains any symbolic links, they must be resolvable.
Return Value of [NSBundle bundleWithPath]
The
NSBundle
object that corresponds to fullPath, or nil
if fullPath does not identify an accessible bundle directory.Discussion of [NSBundle bundleWithPath]
This method allocates and initializes the returned object if there is no existing
NSBundle
associated with fullPath, in which case it returns the existing object.
Example of [NSBundle bundleWithPath]
NSBundle *staticBundle = [NSBundle bundleWithPath:[[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:@"yy.bundle"]];
NSString *filePath = [[jsBundle resourcePath]stringByAppendingPathComponent:fileName];
NSString* content = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];