سؤال

There are two ways to get a NSManagedObjectContext that I know of:

  1. create a UIManagedDocument and ask for its managed object context

  2. access the AppDelegate's managedObjectContext @property.

What are the trade-offs here? I've been doing it the UIManagedDocument way, but I can't seem to find an explanation anywhere on when/why you'd choose one over the other. Any clarification would be greatly appreciated!

هل كانت مفيدة؟

المحلول

Use UIManagedDocument if you're arranging data in a manner that the user perceives as a "document"'s worth of data. If you are not, then you could use UIManagedDocument or the AppDelegate mechanism interchangeably.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top