Instance Method

setURL:forKey:

Sets the value of the specified default key to the specified URL.

Declaration

- (void)setURL:(NSURL *)url forKey:(NSString *)defaultName;

Parameters

url

The URL to store in the defaults database.

defaultName

The key with which to associate the value.

Discussion

If url is a file URL, this method takes the absoluteURL, determines whether its path can be made relative to the user’s home directory, and if so, abbreviates it using the stringByAbbreviatingWithTildeInPath method.

If url isn’t a file URL, a data object is created by calling the archivedDataWithRootObject: method and passing url as the root object.

See Also

Setting Default Values

- setObject:forKey:

Sets the value of the specified default key.

- setFloat:forKey:

Sets the value of the specified default key to the specified float value.

- setDouble:forKey:

Sets the value of the specified default key to the double value.

- setInteger:forKey:

Sets the value of the specified default key to the specified integer value.

- setBool:forKey:

Sets the value of the specified default key to the specified Boolean value.