0

I have some strange problem,my code is

NSLog(@"A:%@",a);
b=[NSString stringWithFormat:@"1800-%@",a];
NSLog(@"B:%@",b);

The output is,

A:5555555
B:Safari free

I dont know what the problem is?

3
  • What are the types of a and b? Commented Jan 31, 2011 at 14:04
  • NSString, or NSString *? (I'm guessing the latter, since I don't know how it would compile, otherwise.) Commented Jan 31, 2011 at 14:07
  • NSString * only marcelo. i assigned IBOutlet that the problem. @kingofbliss mentioned that i his answer. Anyway thanks for your help Commented Jan 31, 2011 at 14:09

2 Answers 2

3

I have once encountered this kind of problem. The mistake i did was, i assigned IBOutlet to NSString

IBOutlet NSString *string;

You may also assign IBOutlet to that NSString, please check, if so remove that.

Sign up to request clarification or add additional context in comments.

1 Comment

OMG how i didnt notice this!! Thanks man. its my mistake while using ctrl+c, ctrl+v :). Thanks again
0

Could be memory overwrites/over releasing, try running with NSZombieEnabled set in the environment (edit the environment in Xcode executable settings) or enable GuardMalloc (in the run menu).

Instruments now has a zombie tool too.

1 Comment

thanks for your help. i have received solution from kingofbliss, now it solved. I think if it is releases means it will crash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.