Instance Method

typeOfFile:error:

Returns the uniform type identifier of the specified file, if it can be determined..

Declaration

- (NSString *)typeOfFile:(NSString *)absoluteFilePath error:(NSError * _Nullable *)outError;

Parameters

absoluteFilePath

The absolute path of the file.

outError

If the Uniform Type Identifier of the file at absolutePath can’t be determined, outError contains an NSError object that describes why.

Return Value

An NSString containing the uniform type identifier of the file at absoluteFilePath. If no UTI can be determined the return value is nil.

Discussion

If the file at the specified path is a symbolic link, the type of the symbolic link is returned.

It is safe to call this method from any thread of your app.

See Also

Manipulating Uniform Type Identifier Information

- localizedDescriptionForType:

Returns the localized description for the specified Uniform Type Identifier

- preferredFilenameExtensionForType:

Returns the preferred filename extension for the specified Uniform Type Identifier.

- filenameExtension:isValidForType:

Returns whether the specified filename extension is appropriate for the Uniform Type Identifier.

- type:conformsToType:

Returns a Boolean indicating that the first Uniform Type Identifier conforms to the second Uniform Type Identifier.

- URLForApplicationWithBundleIdentifier:

Returns the URL for the app with the specified identifier.