I am new in iPhone developement and I have a EXC_BAD_ACCESS error.
In my .h file I declare:
NSString *myString;
In my .m file, I have two methods:
1.The (void)locationManager of CLLocationManager interface when I do it:
myString = [NSString stringWithFormat:@"%lf",loc.longitude];
NSLog(@"%@",myString); // it works
2.A (void)sendPosition method with:
NSLog(@"%@",myString); // EXC_BAD_ACCESS
Can you help me?
Retain your string.
myString = [[NSString stringWithFormat:@”%lf”,loc.longitude] retain];
Then in your dealloc method of this class (or add it)
-(void) dealloc{
[super dealloc];
[myString release];
}
that should fix it, assuming you have declared myString in you .h file.