I have three class variables:
And this code in a method:
I would expect "[listEnvironmentKeys count]" and "[listEnvironmentValues count]" to be "1" after adding an object to each. But it turns out to be zero.
Also, when I try to get the object from either array, I get an "Invalid parameter not satisfying: aString != nil" error.
(From another method called later...)
What am I doing wrong?
Code:
NSMutableDictionary *dictEnvironment;
NSMutableArray *listEnvironmentKeys;
NSMutableArray *listEnvironmentValues;
And this code in a method:
Code:
- (void)createEnvironment
{
NSString *strCurrentEnvironmentKey = @"DISPLAY";
NSString *strCurrentEnvironmentValue = @"localhost:0";
[listEnvironmentKeys addObject:strCurrentEnvironmentKey];
[listEnvironmentValues addObject:strCurrentEnvironmentValue];
dictEnvironment = [NSDictionary dictionaryWithObjects:listEnvironmentValues forKeys:listEnvironmentKeys];
[textEnvironmentKey setIntValue:[listEnvironmentKeys count]];
[textEnvironmentValue setIntValue:[listEnvironmentValues count]];
}
I would expect "[listEnvironmentKeys count]" and "[listEnvironmentValues count]" to be "1" after adding an object to each. But it turns out to be zero.
Also, when I try to get the object from either array, I get an "Invalid parameter not satisfying: aString != nil" error.
Code:
NSString *strCurrentEnvironmentKey = [listEnvironmentKeys objectAtIndex:countEnvironmentKeys];
NSString *strCurrentEnvironmentValue = [listEnvironmentValues objectAtIndex:countEnvironmentKeys];
What am I doing wrong?