Instance Method

setTemporaryResourceValue:forKey:

Sets a temporary resource value on the URL object.

Declaration

- (void)setTemporaryResourceValue:(id)value forKey:(NSURLResourceKey)key;

Parameters

value

The value to store.

key

The key where the value should be stored. This key must be unique and must not conflict with any system-defined keys. Reverse-domain-name notation is recommended.

Discussion

Your app can use a temporary resource value to temporarily store a value for an app-defined resource value key in memory without modifying the actual resource that the URL represents. Once set, you can copy the temporary resource value from the URL object just as you would copy system-defined keys—by calling getResourceValue:forKey:error: or resourceValuesForKeys:error:.

Your app can remove a temporary resource value from the URL object by calling removeCachedResourceValueForKey: or removeAllCachedResourceValues (to remove all temporary values).

This method is applicable only to URLs for file system resources.

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.

- setResourceValues:error:

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

- 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.

NSURLResourceKey

Keys that apply to file system URLs.