• 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 load document store without document for QuickLook plugin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data load document store without document for QuickLook plugin


  • Subject: Re: Core Data load document store without document for QuickLook plugin
  • From: David Sinclair <email@hidden>
  • Date: Fri, 21 Dec 2007 13:08:26 -0800


On Dec 21, 2007, at 12:26:18, mmalc crawford wrote:


On Dec 21, 2007, at 12:16 PM, David Sinclair wrote:

Not sure. No non-Apple frameworks. In the app, I link against Carbon, Cocoa, CoreFoundation, CoreServices, Foundation, AppKit, ExceptionHandling, SystemConfiguration, AddressBook, CoreData, and WebKit. The plugin wouldn't use several of those.

Which version of Mac OS X are you targeting?

Leopard.

As a first step, override managedObjectModel:

- (id)managedObjectModel
{
static id sharedModel = nil;
if (sharedModel == nil)
{
NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"MyDocument" ofType:@"mom"];
NSURL *modelURL = [NSURL fileURLWithPath:modelPath];

sharedModel = [[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL] autorelease];
}
return sharedModel;
}
(written in Mail).


After substituting [NSBundle bundleForClass:[self class]] for [NSBundle mainBundle], that worked.

So based on that clue, I changed my code to:

managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObject:[NSBundle bundleForClass:[self class]]]] retain];

And that also worked. The key was that the -mainBundle was /usr/bin (presumably the QuickLook engine), not the plugin, so using the correct bundle fixed it.

Thank you!

--

David Sinclair, Dejal Systems, LLC - email@hidden
Dejal blog - http://www.dejal.com/blog/
Cocoa code - http://www.dejal.com/developer/
Now on Twitter - http://twitter.com/dejal/





Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

References: 
 >Core Data load document store without document for QuickLook plugin (From: David Sinclair <email@hidden>)
 >Re: Core Data load document store without document for QuickLook plugin (From: mmalc crawford <email@hidden>)
 >Re: Core Data load document store without document for QuickLook plugin (From: David Sinclair <email@hidden>)
 >Re: Core Data load document store without document for QuickLook plugin (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Getting the OutlineView for contextual menu?
  • Next by Date: Re: Opacity of Menus
  • Previous by thread: Re: Core Data load document store without document for QuickLook plugin
  • Next by thread: Getting the OutlineView for contextual menu?
  • Index(es):
    • Date
    • Thread