Re: What is wrong here?
Re: What is wrong here?
- Subject: Re: What is wrong here?
- From: Sherm Pendley <email@hidden>
- Date: Wed, 18 Jun 2003 04:54:51 -0400
On Wednesday, June 18, 2003, at 04:36 AM, Peter Karlsson wrote:
records6 = [[NSMutableArray alloc] initWithObjects: @"Cocoa", @"Is",
@"Good", nil];
records7 = [[NSMutableArray alloc] initWithObjects: @"Cocoa", @"Is",
@"Great", nil];
myBigArray = [[NSMutableArray alloc] initWithObjects:records6,
records7, nil];
...
theRecord = [[myBigArray objectAtIndex:index] objectAtIndex:rowIndex];
"theRecord" is now an NSString object.
theValue = [theRecord objectForKey:[aTableColumn identifier]];
Here, you're sending "theRecord" an "objectForKey:" message.
NSDictionaries respond to that message, but strings don't.
It works as long as my index is 0, but if the index is 1 I get a error
message saying:
*** -[NSConstantString objectForKey:]: selector not recognized
What can be wrong here?
The error message describes what is happening perfectly - you're sending
an "objectForKey:" message to an object, and that object is an instance
of a class (NSConstantString, a concrete subclass within the NSString
cluster) that doesn't respond to that selector.
What I find odd is that an error is *not* produced when the index is 0.
If the example you gave is straight from your code, it should be
producing the same error every time, regardless of the value of index.
sherm--
"But i don't want to go among mad people," Alice remarked.
"Oh, you can't help that," said the Cat: "we're all mad here. I'm mad,
You're mad."
"How do you know I'm mad?" said Alice.
"You must be," said the Cat, "or you wouldn't have come here."
"Alice in Wonderland" - Lewis Carrol
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.