Class: NSPersistentStore

Inherits:
NSObject show all

Overview

This class is the abstract base class for all Core Data persistent stores.

Direct Known Subclasses

NSAtomicStore, NSIncrementalStore

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Class Method Details

+ (Hash) metadataForPersistentStoreWithURL(url, error:error)

Returns the metadata from the persistent store at the given URL.

Parameters:

  • url (NSURL)

    The location of the store.

  • error (Pointer)

    If an error occurs, upon return contains an NSError object that describes the problem.

Returns:

  • (Hash)

    The metadata from the persistent store at url. Returns nil if there is an error.

+ (Class) migrationManagerClass

Returns the NSMigrationManager class for this store class. In a subclass of NSPersistentStore, you can override this to provide a custom migration manager subclass (for example, to take advantage of store-specific functionality to improve migration performance).

Returns:

+ (Boolean) setMetadata(metadata, forPersistentStoreWithURL:url, error:error)

Sets the metadata for the store at a given URL.

Parameters:

  • metadata (Hash)

    The metadata for the store at url.

  • url (NSURL)

    The location of the store.

  • error (Pointer)

    If an error occurs, upon return contains an NSError object that describes the problem.

Returns:

  • (Boolean)

    YES if the metadata was written correctly, otherwise NO.

Instance Method Details

- (String) configurationName

Returns the name of the managed object model configuration used to create the receiver.

Returns:

  • (String)

    The name of the managed object model configuration used to create the receiver.

- (Object) didAddToPersistentStoreCoordinator(coordinator)

Invoked after the receiver has been added to the persistent store coordinator. The default implementation does nothing. You can override this method in a subclass in order to perform any kind of setup necessary before the load method is invoked.

Parameters:

Returns:

- (String) identifier

Returns the unique identifier for the receiver. The identifier is used as part of the managed object IDs for each object in the store.

Returns:

  • (String)

    The unique identifier for the receiver.

- (Object) initWithPersistentStoreCoordinator(root, configurationName:name, URL:url, options:options)

Returns a store initialized with the given arguments. You must ensure that you load metadata during initialization and set it using setMetadata:.

Parameters:

  • coordinator (NSPersistentStoreCoordinator)

    A persistent store coordinator.

  • configurationName (String)

    The name of the managed object model configuration to use. Pass nil if you do not want to specify a configuration.

  • url (NSURL)

    The URL of the store to load.

  • options (Hash)

    A dictionary containing configuration options. See NSPersistentStoreCoordinator for a list of key names for options in this dictionary.

Returns:

  • (Object)

    A new store object, associated with coordinator, that represents a persistent store at url using the options in options and—if it is not nil—the managed object model configuration configurationName.

- (Boolean) isReadOnly

Returns a Boolean value that indicates whether the receiver is read-only.

Returns:

  • (Boolean)

    YES if the receiver is read-only, otherwise NO.

- (Boolean) loadMetadata(error)

Instructs the receiver to load its metadata.

Parameters:

  • error (Pointer)

    If an error occurs, upon return contains an NSError object that describes the problem.

Returns:

  • (Boolean)

    YES if the metadata was loaded correctly, otherwise NO.

- (Hash) metadata

Returns the metadata for the receiver.

Returns:

  • (Hash)

    The metadata for the receiver. The dictionary must include the store type (NSStoreTypeKey) and UUID (NSStoreUUIDKey).

- (Hash) options

Returns the options with which the receiver was created. See NSPersistentStoreCoordinator for a list of key names for options in this dictionary.

Returns:

  • (Hash)

    The options with which the receiver was created.

- (NSPersistentStoreCoordinator) persistentStoreCoordinator

Returns the persistent store coordinator which loaded the receiver.

Returns:

- (Object) setIdentifier(identifier)

Sets the unique identifier for the receiver.

Parameters:

  • identifier (String)

    The unique identifier for the receiver.

Returns:

- (Object) setMetadata(storeMetadata)

Sets the metadata for the receiver.

Parameters:

  • storeMetadata (Hash)

    The metadata for the receiver.

Returns:

- (Object) setReadOnly(flag)

Sets whether the receiver is read-only.

Parameters:

  • flag (Boolean)

    YES if the receiver is read-only, otherwise NO.

Returns:

- (Object) setURL(url)

Sets the URL for the receiver. To alter the location of a store, send the persistent store coordinator a setURL:forPersistentStore: message.

Parameters:

  • url (NSURL)

    The URL for the receiver.

Returns:

- (String) type

Returns the type string of the receiver. This string is used when specifying the type of store to add to a persistent store coordinator.

Returns:

  • (String)

    The type string of the receiver.

- (NSURL) URL

Returns the URL for the receiver.

Returns:

  • (NSURL)

    The URL for the receiver.

- (Object) willRemoveFromPersistentStoreCoordinator(coordinator)

Invoked before the receiver is removed from the persistent store coordinator. The default implementation does nothing. You can override this method in a subclass in order to perform any clean-up before the store is removed from the coordinator (and deallocated).

Parameters:

Returns: