I have code that scans and returns NSString
like this:
NSString *GetText = [[NSString alloc] init];
NSString *ScannedText;
NSScanner *TheScanner = [NSScanner scannerWithString:somLongString];
int start=0;
int index=0;
int ObjectCount;
char c;
for (int i = 0; i < [somLongString length] ; i++) {
c = [somLongString characterAtIndex:i];
if (c == '=') {
start = i+1;
[TheScanner setScanLocation:start];
[TheScanner scanUpToString:@"&" intoString:&GetText];
NSLog( @"%@",GetText);
[UserValuesObject insertObject:GetText atIndex:index];
NSLog(@"%@",[UserValuesObject objectAtIndex:index]);
index++;
}
}
Now I want to add the GetText
object I am creating each time to an array. When I try printing the first:
NSLog(@"%@",GetText);
it works! But when I am tring to add it to the object and then print (for debug) I am getting null
on each print of the log:
NSLog(@"%@",[UserValuesObject objectAtIndex:index]);
any ideas?