Skip navigation.
 
mlRe: NSMutableDictionary initialization problems
FROM : James Spencer
DATE : Sun Oct 17 22:32:25 2004

On Oct 17, 2004, at 2:13 PM, Jacob Lukas wrote:

> I have a subclass of NSDocumentController. In this subclass, I
> maintain a mutable array. Unfortunately, I cannot find a way to
> initialize it.
>
> I tried the following methods in -init:
> _myArray = [NSMutableDictionary dictionary];
> -> _myArray is an NSCFString
> _myArray = [NSMutableDictionary dictionaryWithDictionary:[NSDictionary
> dictionary]];
> -> _myArray is a CFDictionary
> _myArray = [[NSDictionary dictionary] mutableCopy];
> -> _myArray is a CFDictionary
>
> I tried initializing _myArray just before I use it:
> if (!_myArray)
>     _myArray = [NSMutableDictionary dictionary];
> [_myArray addObject:someObject];
>
> but that doesn't work... _myArray is a CFDictionary
>


If _myArray is declared as a mutable array, i.e.

NSMutableArray * _myArray;

then why are you trying to initialize it with a dictionary?

James P. Spencer
Rochester, MN

<email_removed>

"Badges??  We don't need no stinkin badges!"

Related mailsAuthorDate
mlNSMutableDictionary initialization problems Jacob Lukas Oct 17, 21:13
mlRe: NSMutableDictionary initialization problems James Spencer Oct 17, 22:32
mlRe: NSMutableDictionary initialization problems Scott Stevenson Oct 18, 00:17
mlRe: NSMutableDictionary initialization problems Jacob Lukas Oct 18, 08:09