Yep, you really need to read the Objective-C docs. Besides all the memory leaks talked about in your other thread there are many other things wrong with this code, or at least things that can be done better.
The biggest thing that is causing your problem is the string comparisons. You can't compare two strings for equality by using the '==' operator. In all the C derived languages, among many others, the '==' operator compares if two objects are the same object, not the same value. The NSString class has the method 'isEqualToString:'. So change:
one_char == testp
to:
[one_char isEqualToString:testp]
And to create a string you are doing it in a very inefficient way. For example, instead of:
test4 = [[NSString alloc] initWithFormat:@"4"]
just do:
test4 = @"4";
This also eliminates one of your leaks.
That's enough for now. HTH.
|