user596931
user596931

Reputation:

Problem with NSString

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?

Upvotes: 0

Views: 136

Answers (2)

Steven Kramer
Steven Kramer

Reputation: 8513

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.

Upvotes: 0

KingofBliss
KingofBliss

Reputation: 15115

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.

Upvotes: 3

Related Questions