Returns an array of file URLs for all resources identified by the specified file extension and located in the specified bundle subdirectory.
SDKs
- iOS 4.0+
- macOS 10.6+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
Parameters
extension
The filename extension of the files to locate.
If you specify an empty string or
nil
, the extension is assumed not to exist and all of the files insubpath
are returned.subpath
The name of the bundle subdirectory.
Return Value
An array of file URLs for the resource files or nil
if no files could be located at subpath
with extension
. Returns an empty array if no matching resource files are found.
Discussion
If subpath
is nil
, this method searches the top-level non-localized resource directory and the top-level of any language-specific directories. (In macOS, the top-level non-localized resource directory is typically called Resources
but in iOS, it is the main bundle directory.)
For example, suppose you have a Mac app with a modern bundle and you specify @"Documentation"
for the subpath
parameter. This method would first look in the Contents/Resources/Documentation
directory of the bundle, followed by the Documentation
subdirectories of each language-specific .lproj
directory. (The search order for the language-specific directories corresponds to the user’s preferences.) This method does not recurse through any other subdirectories at any of these locations. For more details see The Bundle Search Pattern in Bundle Programming Guide.