Class: NSManagedObjectModel
Overview
An NSManagedObjectModel object describes a schema—a collection of entities (data models) that you use in your application.
Class Method Summary (collapse)
-
+ mergedModelFromBundles:
Returns a model created by merging all the models found in given bundles.
-
+ mergedModelFromBundles:forStoreMetadata:
Returns a merged model from a specified array for the version information in provided metadata.
-
+ modelByMergingModels:
Creates a single model from an array of existing models.
-
+ modelByMergingModels:forStoreMetadata:
Returns, for the version information in given metadata, a model merged from a given array of models.
Instance Method Summary (collapse)
-
- configurations
Returns all the available configuration names of the receiver.
-
- entities
Returns the entities in the receiver.
-
- entitiesByName
Returns the entities of the receiver in a dictionary.
-
- entitiesForConfiguration:
Returns the entities of the receiver for a specified configuration.
-
- entityVersionHashesByName
Returns a dictionary of the version hashes for the entities in the receiver.
-
- fetchRequestFromTemplateWithName:substitutionVariables:
Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary.
-
- fetchRequestTemplateForName:
Returns the fetch request with a specified name.
-
- fetchRequestTemplatesByName
Returns a dictionary of the receiver’s fetch request templates.
-
- initWithContentsOfURL:
Initializes the receiver using the model file at the specified URL.
-
- isConfiguration:compatibleWithStoreMetadata:
Returns a Boolean value that indicates whether a given configuration in the receiver is compatible with given metadata from a persistent store.
-
- localizationDictionary
Returns the localization dictionary of the receiver.
-
- setEntities:
Sets the entities array of the receiver.
-
- setEntities:forConfiguration:
Associates the specified entities with the receiver using the given configuration name.
-
- setFetchRequestTemplate:forName:
Associates the specified fetch request with the receiver using the given name.
-
- setLocalizationDictionary:
Sets the localization dictionary of the receiver.
-
- setVersionIdentifiers:
Sets the identifiers for the receiver.
-
- versionIdentifiers
Returns the collection of developer-defined version identifiers for the receiver.
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
+ (NSManagedObjectModel) mergedModelFromBundles(bundles)
Returns a model created by merging all the models found in given bundles.
+ (NSManagedObjectModel) mergedModelFromBundles(bundles, forStoreMetadata:metadata)
Returns a merged model from a specified array for the version information in provided metadata. This method is a companion to mergedModelFromBundles:.
+ (NSManagedObjectModel) modelByMergingModels(models)
Creates a single model from an array of existing models. You use this method to combine multiple models (typically from different frameworks) into one.
+ (NSManagedObjectModel) modelByMergingModels(models, forStoreMetadata:metadata)
Returns, for the version information in given metadata, a model merged from a given array of models. This is the companion method to mergedModelFromBundles:forStoreMetadata:.
Instance Method Details
- (Array) configurations
Returns all the available configuration names of the receiver.
- (Array) entities
Returns the entities in the receiver. Entities are instances of NSEntityDescription.
- (Hash) entitiesByName
Returns the entities of the receiver in a dictionary.
- (Array) entitiesForConfiguration(configuration)
Returns the entities of the receiver for a specified configuration.
- (Hash) entityVersionHashesByName
Returns a dictionary of the version hashes for the entities in the receiver. The dictionary of version hash information is used by Core Data to determine schema compatibility.
- (NSFetchRequest) fetchRequestFromTemplateWithName(name, substitutionVariables:variables)
Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary. The variables dictionary must provide values for all the variables. If you want to test for a nil value, use [NSNull null]. This method provides the usual way to bind an “abstractly” defined fetch request template to a concrete fetch. For more details on using this method, see Creating Predicates.
- (NSFetchRequest) fetchRequestTemplateForName(name)
Returns the fetch request with a specified name. If the template contains substitution variables, you should instead use fetchRequestFromTemplateWithName:substitutionVariables: to create a new fetch request.
- (Hash) fetchRequestTemplatesByName
Returns a dictionary of the receiver’s fetch request templates. If the template contains a predicate with substitution variables, you should instead use fetchRequestFromTemplateWithName:substitutionVariables: to create a new fetch request.
- (Object) initWithContentsOfURL(url)
Initializes the receiver using the model file at the specified URL.
- (Boolean) isConfiguration(configuration, compatibleWithStoreMetadata:metadata)
Returns a Boolean value that indicates whether a given configuration in the receiver is compatible with given metadata from a persistent store. This method compares the version information in the store metadata with the entity versions of a given configuration. For information on specific differences, use entityVersionHashesByName and perform an entity-by-entity comparison.
- (Hash) localizationDictionary
Returns the localization dictionary of the receiver. The key-value pattern is described in setLocalizationDictionary:.
- (Object) setEntities(entities)
Sets the entities array of the receiver.
- (Object) setEntities(entities, forConfiguration:configuration)
Associates the specified entities with the receiver using the given configuration name.
- (Object) setFetchRequestTemplate(fetchRequest, forName:name)
Associates the specified fetch request with the receiver using the given name. For more details on using this method, see Creating Predicates.
- (Object) setLocalizationDictionary(localizationDictionary)
Sets the localization dictionary of the receiver. Table 1 describes the key and value pattern for the localization dictionary.Table 1 Key and value pattern for the localization dictionary.
Key Value Note “Entity/NonLocalizedEntityName” “LocalizedEntityName”
“Property/NonLocalizedPropertyName/Entity/EntityName” “LocalizedPropertyName” (1) “Property/NonLocalizedPropertyName” “LocalizedPropertyName”
“ErrorString/NonLocalizedErrorString” “LocalizedErrorString”
(1) For properties in different entities with the same non-localized name but which should have different localized names.
- (Object) setVersionIdentifiers(identifiers)
Sets the identifiers for the receiver.
- (NSSet) versionIdentifiers
Returns the collection of developer-defined version identifiers for the receiver. The Core Data framework does not give models a default identifier, nor does it depend this value at runtime. For models created in Xcode, you set this value in the model inspector. This value is meant to be used as a debugging hint to help you determine the models that were combined to create a merged model.