Sets the metadata for the store at a given URL.
SDKs
- iOS 3.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Core Data
Declaration
+ (BOOL)setMetadata:(NSDictionary<NSString *,id> *)metadata forPersistentStoreWithURL:(NSURL *)url error:(NSError * _Nullable *)error;
Parameters
metadata
The metadata for the store at
url
.url
The location of the store.
error
If an error occurs, upon return contains an
NSError
object that describes the problem.
Return Value
YES
if the metadata was written correctly, otherwise NO
.
Discussion
Subclasses must override this method to set metadata appropriately.
Discussion
Handling Errors in Swift:
In Swift, this method returns a nonoptional result and is marked with the throws
keyword to indicate that it throws an error in cases of failure.
You call this method in a try
expression and handle any errors in the catch
clauses of a do
statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.