Instance Method

setResourceValues:error:

Sets the URL’s resource properties for a given set of keys to a given set of values.

Declaration

- (BOOL)setResourceValues:(NSDictionary<NSURLResourceKey, id> *)keyedValues error:(NSError * _Nullable *)error;

Parameters

keyedValues

A dictionary of resource values to be set.

error

The error that occurred if one or more resource values could not be set.

Return Value

YES if all resource values in keyedValues are successfully set; otherwise, NO.

Discussion

This method synchronously writes the new resource value out to disk. If an error occurs after some resource properties have been successfully changed, the userInfo dictionary in the returned error object contains a kCFURLKeysOfUnsetValuesKey key whose value is an array of the resource values that were not successfully set.

Attempts to set a read-only resource property or to set a resource property that is not supported by the resource are ignored and are not considered errors.

The order in which the resource values are set is not defined. If you need to guarantee the order in which resource values are set, you should make multiple requests to this method or setResourceValue:forKey:error:.

See Also

Accessing Resource Values

- resourceValuesForKeys:error:

Returns the resource values for the properties identified by specified array of keys.

- getResourceValue:forKey:error:

Returns the value of the resource property for the specified key.

- setResourceValue:forKey:error:

Sets the URL’s resource property for a given key to a given value.

- removeAllCachedResourceValues

Removes all cached resource values and temporary resource values from the URL object.

- removeCachedResourceValueForKey:

Removes the cached resource value identified by a given key from the URL object.

- setTemporaryResourceValue:forKey:

Sets a temporary resource value on the URL object.

NSURLResourceKey

Keys that apply to file system URLs.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software