Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 10-24-2008, 04:35 AM   #18 (permalink)
pashik
Registered Member
 
Join Date: Jul 2008
Location: Kiev
Posts: 75
pashik is on a distinguished road
Default

Quote:
Originally Posted by varchar View Post
I have solved this problem.

Basically the way to solve is to ignore the locationupdate if it is not very accurate or it is to old.

Below is the code... It works like a charm.... I get amazing accuracy... I am so happy!

Code:

// Called when the location is updated
- (void)locationManager:(CLLocationManager *)manager
	didUpdateToLocation:(CLLocation *)newLocation
		   fromLocation:(CLLocation *)oldLocation
{
	
	NSDate* newLocationeventDate = newLocation.timestamp;
	NSTimeInterval howRecentNewLocation = [newLocationeventDate timeIntervalSinceNow];
	
	// Needed to filter cached and too old locations
	if ((!currentLocation || currentLocation.horizontalAccuracy > newLocation.horizontalAccuracy) &&
		(howRecentNewLocation < -0.0 && howRecentNewLocation > -10.0)) {
		if (currentLocation)
			[currentLocation release];
		
		currentLocation = [newLocation retain];
	}
	
}
...
Can u post a bit more code, e.g. where do u initialize currentLocation, how do u call timer, do u use timer in controller which is fired every n seconds etc.

Last edited by pashik; 10-24-2008 at 05:36 AM.
pashik is offline   Reply With Quote
 

» Advertisements
» Online Users: 418
14 members and 404 guests
Chickenrig, dinoclaud, Domele, flamingliquid, Gaz, iconomania, ilmman, JavierEPease, M0schinO, poke, raymng, santicarlo, Techknol, UconnAggie
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,590
Threads: 94,083
Posts: 402,776
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JavierEPease
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.