• 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: question about classes, I think
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about classes, I think


  • Subject: Re: question about classes, I think
  • From: Bill Bumgarner <email@hidden>
  • Date: Thu, 11 May 2006 20:55:01 -0700

On May 11, 2006, at 7:20 PM, Alan Smith wrote:

@implementation EVTable
- (void)awakeFromNib
{
tableContents = [[[NSMutableArray alloc] initWithCapacity:3] retain];

tableContents is over retained.

}

- (NSArray*)contents
{
   //When logged, nothing is output except "(null)"

That means that tableContents hasn't been set yet. if you are using Controllers, it may be that this method is being invoked prior to - awakeFromNib being called.


   NSLog(@" %@ ", tableContents);
   return tableContents;
}

- (void)appIsDoneLoading
{
   NSLog(@"The files are going to be added to the EV Classic table");

   //Collects the path of the folder that the EV Classic plugins
should be stored in.
   NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   NSString *pluginFolder = [[defaults
dictionaryForKey:@"pathForPluginsStorage"] valueForKey:@"3"];

Huh? This is weird.

First, name defaults something english like.

Secondly, a key of "3" isn't terribly informative.

   NSMutableArray *contents = [[pluginHelper alloc]
pluginsInFolder:pluginFolder forGame:@"0"];
   [contents retain];

No need to retain then release below.

tableContents = contents;

Thus rendering the code in awakeFromNib completely irrelevant (and a leak)....


   [contents release];

   //Updates the table
   [table reloadData];

   NSLog(@"Done putting the files in the EV Classic table");
}

- (void)manageEVPlugins
{
   NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   NSString *pluginFolder = [[defaults
dictionaryForKey:@"pathForGames"] valueForKey:@"0"];

What does "0" mean?

   //By this time the array I want is empty
   [[pluginHelper alloc] managePlugins:[self contents]
inGamesFolder:pluginFolder];

Hard to tell what else is going on without knowing more about the structure of your app....


However, I would recommend going and having a close read of the various Cocoa documentation.

b.bum
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >question about classes, I think (From: "Alan Smith" <email@hidden>)
 >Re: question about classes, I think (From: "Shawn Erickson" <email@hidden>)
 >Re: question about classes, I think (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: question about classes, I think
  • Next by Date: Re: NSDrawer in System Pref Pane
  • Previous by thread: Re: question about classes, I think
  • Next by thread: Core Data delayed notification after sleep
  • Index(es):
    • Date
    • Thread