Hi Steven

> How? If you don't have an instantiation of the class you don't have 
> anywhere to store the data.
> Either I am misunderstanding what you are saying or you are missing my 
> suggestion of class methods.
> Perhaps you could explain?

// StaticClass.h
@interface StaticClass : NSObject
{
}

+ (NSManagedObjectContext *) managedObjectContext;

@end

//StaticClass.m
@implementation StaticClass

static NSManagedObjectContext *managedObjectContext = nil;

+ (NSManagedObjectContext *) managedObjectContext
{
  if (!managedObjectContext)
  {

    … // create and setup

  }
  return managedObjectContext;
}

@end


This can then be accessed from other code as…

{
  NSManagedObjectContext *context = [StaticClass managedObjectContext];

  …
}

Joanna

--
Joanna Carter
Carter Consulting

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to