• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data application types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data application types


  • Subject: Re: Core Data application types
  • From: Bill Dudney <email@hidden>
  • Date: Fri, 18 May 2007 10:42:37 -0700

Hi Mark,

You should be able to have as many managed object models as necessary.

something like this;

- (NSManagedObjectModel *)managedObjectModel {

    if (managedObjectModel != nil) {
        return managedObjectModel;
    }

    managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
    return managedObjectModel;
}

will load all your models into the single managed object model.

Then you can create your persistence context and from there add stores.

When it comes time to open your 'library' store you can do something like this;

NSArray * paths = NSSearchPathForDirectoriesInDomains (
   NSApplicationSupportDirectory,
   NSUserDomainMask | NSLocalDomainMask,
  TRUE
);
// look for the library in each path, when found
libURL = [NSURL URLWithString:libPath];
NSError *error = nil;
NSPersistentStore *libStore = [[self persistentStoreCoordinator] addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:libURL options:nil error:&error];

// now your library store is avalible just as everything else is through your managed object context

if there is possible confusion about where an object should go you can be explicit with;

[[self managedObjectContext] assignObject:potentialConflict toPersistentStore:libraryStore];

HTH,

-bd-
On Friday, May 18, 2007, at 10:58AM, "MH" <email@hidden> wrote:
>Yes, Sorry I hit my send button a little too quickly.
>
>I'm making the mistake of trying to run 2 applications. I'm interested
>to know how one would maintain 2 stores of different types within 1
>application.
>
>1. There is the library store
>2. Is the individual document that is bound to it that can also update
>its content.
>
>It seems to me that 2 models and 2 managedContexts are needed for this
>type of thing, but I'm a not quite sure how to go about it.
>
>I thought that core data automatically aggregated the various
>.xcdatamodels at runtime, which to my mind would be confusing the
>issue, but I'm probably mistaken.
>_______________________________________________
>
>Cocoa-dev mailing list (email@hidden)
>
>Do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>
>This email sent to email@hidden
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Core Data application types
      • From: mmalc crawford <email@hidden>
References: 
 >Core Data application types (From: "Mark Hill" <email@hidden>)
 >Re: Core Data application types (From: mmalc crawford <email@hidden>)
 >Re: Core Data application types (From: MH <email@hidden>)

  • Prev by Date: Re: initilalization of an IBOutlet object
  • Next by Date: Re: Core Data application types
  • Previous by thread: Re: Core Data application types
  • Next by thread: Re: Core Data application types
  • Index(es):
    • Date
    • Thread