I got rid of my set methods and tried using this way:
Code:
NSLog(@"Setting Postition");
self.currentPosition = newLocation;
NSLog(@"Position Set");
NSLog(@"Getting current date");
NSDate *currentDate = [NSDate date];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"MMM dd, yyyy HH:mm"];
NSString *dateString = [[NSString alloc] initWithString:[format stringFromDate:currentDate]];
NSLog(@"Date Set");
NSString *entryString = [[NSString alloc] initWithString:entry.text];
[entry release];
[format release];
[currentDate release];
float lat = currentPosition.coordinate.latitude;
float lon = currentPosition.coordinate.longitude;
NSString *location;
if (lat < 0 && lat < 0)
{
lat = -lat;
lon = -lon;
location = [[NSString alloc] initWithFormat:@"Latitude:%1.2f°S Longitude:%1.2f°W", lat, lon];
}
else if (lat> 0 && lon > 0)
{
location = [[NSString alloc] initWithFormat:@"Latitude:%1.2f°N Longitude:%1.2f°E", lat, lon];
}
else if (lon < 0 && lat > 0)
{
lon = -lon;
location = [[NSString alloc] initWithFormat:@"Latitude:%1.2f°N Longitude:%1.2f°W", lat, lon];
}
else
{
lat = -lat;
location = [[NSString alloc] initWithFormat:@"Latitude:%1.2f°N Longitude:%1.2f°E", lat, lon];
}
NSLog(location);
NSLog(dateString);
NSLog(@"Saving to database");
[appDelegate addEntry:entryString withLocation:location withDate:dateString];
[save setHidden:NO];
[active stopAnimating];
[location release];
[dateString release];
[entryString release];
still getting the same error