• 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: Dictionary? Array? or other
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dictionary? Array? or other


  • Subject: Re: Dictionary? Array? or other
  • From: "Dirk van Oosterbosch, IR labs" <email@hidden>
  • Date: Sat, 3 Sep 2005 18:05:42 +0200


On 3-sep-05, at 17:28, Aaron Wallis wrote:

the source for tempExpression is:

// Create a expression object to relate to its properties
expressionEntry * tempExpression = [[ expressionEntry alloc ] init];
[tempExpression setSeperator : splitStringBy ];
[tempExpression setResult : splitStringResult ];


where expressionEntry is a class I have written.
And there is a [tempExpression release] a few lines down...
expressionsItems is declared in the header file, as its pretty much a global variable...
and when I NSLog it I get null....



You also need to define the dictionary (in your implementation)
NSMutableDictionary * expressionsItems = [[NSMutableDictionary alloc] init];
or
NSMutableDictionary * expressionsItems = [NSMutableDictionary dictionary]; // This makes it autoreleased


I found the concept of global variables not so applicable in a true OO environment like Objective-C / Cocoa, as it would in rather more scripting languages. With Objective-C/Cocoa I only use global variables –with the extern keyword– to declare NSStrings that act as keys for the notificationCenter or the userDefaults. In the case of your example there needs to be an object in the end that holds the collection (or in the case of a FoundationTool just main.m). Then the expressionsItems is just an ivar of that object.

d.


----------------------------- Dirk van Oosterbosch de Wittenstraat 225 1052 AT Amsterdam the Netherlands

http://labs.ixopusada.com
-----------------------------


_______________________________________________ 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
  • Follow-Ups:
    • Re: Dictionary? Array? or other
      • From: Aaron Wallis <email@hidden>
References: 
 >Fwd: Dictionary? Array? or other (From: Aaron Wallis <email@hidden>)

  • Prev by Date: Fwd: Dictionary? Array? or other
  • Next by Date: Re: How to return a list from a script command
  • Previous by thread: Fwd: Dictionary? Array? or other
  • Next by thread: Re: Dictionary? Array? or other
  • Index(es):
    • Date
    • Thread