• 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 and the Application Delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data and the Application Delegate


  • Subject: Re: Core Data and the Application Delegate
  • From: Jason Foreman <email@hidden>
  • Date: Fri, 24 Apr 2009 20:15:54 -0500

On Apr 24, 2009, at 7:47 PM, Jon Gordon wrote:

On Apr 24, 2009, at 4:40 PM, Jason Foreman wrote:

On Apr 23, 2009, at 7:37 PM, Jon Gordon wrote:
But I understand (I think) also that, in a Core Data document- based application, the application delegate is set to one provided by Core Data. And in such cases, providing my own delegate breaks Core Data functionality that I'd otherwise get for free.

The Core Data Application Xcode template does create an class that is hooked up as the application delegate. However you are certainly free to add code to it or replace it with your own delegate, as long as your delegate also provides the functionality that the generated template delegate does (setting up Core Data stack, etc). The default delegate isn't so much "provided by Core Data" as it is "an default generated for you by Xcode."

Thanks for the reply. I've seen this information about the existence of the default delegate elsewhere, but I can't seem to find any information about the delegate itself. Indeed, whenever I ask NSApp what the delegate is (by using NSLog and [NSApp delegate]), it reports that the delegate is null. I've tried searching the docs and Googling the Web, to no avail. Do you know of any documentation for this?

I'm not sure what documentation would be useful [1]. I simply created a new Core Data Application project and looked at what was there. Core Data itself doesn't add an app delegate. Rather, the default Xcode templates have some boilerplate to set up the Core Data stack.


I did overlook the part of your original post where you mention you're using a document-based Core Data app. Those actually don't have a boilerplate application delegate anyway—the document subclass is responsible for the Core Data stack—so I'm not surprised your tests show a nil delegate.

You should have no issues using your own delegate. Have you actually *tried* setting the delegate? It seems your question is based on anecdotes rather than evidence so the best thing would just be to try it and see if it works. I'm betting it will.

Jason


[1] Perhaps the NSPersistentDocument Core Data Tutorial?
<http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/00_Introduction/introduction.html#//apple_ref/doc/uid/TP40002828-SW1 >

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 and the Application Delegate (From: Jon Gordon <email@hidden>)
 >Re: Core Data and the Application Delegate (From: Jason Foreman <email@hidden>)
 >Re: Core Data and the Application Delegate (From: Jon Gordon <email@hidden>)

  • Prev by Date: Re: KVO leaks memory
  • Next by Date: Core Data: thread safety of NSPersistentStore +metadataForPersistentStoreWithURL:... (and +set...)?
  • Previous by thread: Re: Core Data and the Application Delegate
  • Next by thread: Re: Core Data and the Application Delegate
  • Index(es):
    • Date
    • Thread