Total newbie Iphone/ Obj. C question:
I have a class called Location, in the Location.h i declare:
@interface Location : NSObject
{
NSString *lat;
NSString *lon;
}
In my Location.m i have to methods:
-(void)setLatLon:(NSString*)lati:(NSString*)longi
{
NSLog(@"called setLatLon");
lat = lati;
lon = longi;
}
which I call on location updates from the LocationManager. Now when I try to send that out as a JSON with
-(void)sendLocation
{
NSDictionary *sendData = [NSDictionary dictionaryWithObjectsAndKeys:
imei, @"imei",
lat, @"lat",
lon, @"lon",
nil];
...}
i get this error:
*** -[CFString retain]: message sent to deallocated instance 0xc05b5d0
So lat & lon seem to be deallocated. How can I prevent that or have I implemented a totally stupid 'design' here?