• 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: Aaron Wallis <email@hidden>
  • Date: Sun, 4 Sep 2005 09:41:22 +1000

Hi Drik,

thanks a million for the pointer, it worked a charm


Cheers

On 04/09/2005, at 2:05 AM, Dirk van Oosterbosch, IR labs wrote:


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
-----------------------------




Send instant messages to your online friends http://au.messenger.yahoo.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
References: 
 >Fwd: Dictionary? Array? or other (From: Aaron Wallis <email@hidden>)
 >Re: Dictionary? Array? or other (From: "Dirk van Oosterbosch, IR labs" <email@hidden>)

  • Prev by Date: Re: Core Data : where are the docs ?
  • Next by Date: Drawing to scale and display properties
  • Previous by thread: Re: Dictionary? Array? or other
  • Next by thread: Converting HTML entities to NSXMLNode tree
  • Index(es):
    • Date
    • Thread