Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 11-16-2008, 10:33 PM   #2 (permalink)
RickMaddy
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

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.
RickMaddy is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,695
Threads: 89,168
Posts: 380,424
Top Poster: BrianSlick (7,110)
Welcome to our newest member, Castlem
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.