Search Results

Search found 63 results on 3 pages for 'cllocationmanager'.

Page 1/3 | 1 2 3  | Next Page >

  • iPhone Development - CLLocationManager vs. MapKit

    - by Mustafa
    If i want to show userLocation on the map, and at the same time record the user's location, is it a good idea to add an observer to userLocation.location and record the locations, OR should i still use CLLocationManager for recording user location and use mapView.showUserLocation to show the user's current location (blue indicator)? I want to show the default blue indicator supported by the MapKit API. Also, here's a rough sample code: - (void)viewDidLoad { ... locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = DISTANCE_FILTER_VALUE; locationManager.delegate = self; [locationManager startUpdatingLocation]; myMapView.showUserLocation = YES; [myMapView addObserver:self forKeyPath:@"userLocation.location" options:0 context:nil]; ... } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { // Record the location information // ... } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"%s begins.", __FUNCTION__); // Make sure that the location returned has the desired accuracy if (newLocation.horizontalAccuracy <= manager.desiredAccuracy) return; // Record the location information // ... } Under the hood, i think MKMapView also uses CLLocationManager to get user's current location? So, will this create any problems because i believe both CLLocationManager and MapView will try to use same location services? Will there be any conflicts and lack of accurate/required or current data?

    Read the article

  • Forcing CLLocationManager updates - does it help or hurt?

    - by Steve N
    I've been trying to find any way to optimize the performance of my location-based iPhone application and have seen some people mention that you can force location updates by starting and stopping your CLLocationManager. I need the best accuracy I can get, and the user in my case would probably like to see updates every few seconds (say, 10 seconds) as they walk around. I've set the filters accordingly, but I notice that sometimes I don't get any updates on the device for quite some time. I'm testing the following approach, which forces an update when a fixed time interval passes (I'm using 20 seconds). My gut tells me this really won't help me provide more accurate updates to the user, and that just leaving CLLocationManager running all the time is probably the best approach. - (void)forceLocationUpdate { [[LocationManager locationManager] stopUpdates]; [[LocationManager locationManager] startUpdates]; [self performSelector:@selector(forceLocationUpdate) withObject:nil afterDelay:20.0]; } My question is- does forcing updates from CLLocationManager actually improve core location performance? Does it hurt performance? If I'm outside in an open field with good GPS reception, will this help then? Does anyone have experience trying this? Thanks in advance, Steve

    Read the article

  • Iphone SDK 4 [CLLocationManager headingAvailable]

    - by Raphael Pinto
    I used to get disponibility of heading on iphone OS 3.1.3 checking headingAvailable property. But in OS 4.0 it has been deprecated. Now we have to use headingAvailable function. My problem is that I get a : warning: 'headingAvailable' is deprecated when I call the function : if([locationManager headingAvailable]) [locationManager startUpdatingHeading]; I realy want to understand why?!

    Read the article

  • CLLOcationManager will work correctly in iphone sdk?

    - by Mikhail Naimy
    hi, I am using the code which is in the URL stackoverflow.but I have done database operation in that method(didEnterRegionCLRegion ).Will it work correctly without opening the application (in background).I have given alert also.but it is not called.anyone who is experienced , help me in this matter?I am in India..will it give only correct GEO information only for AT&T service provider?Apple did not give any sample code for it?I have registered location in viewcontroller, i have to do the same in any Delegate methods?

    Read the article

  • Why the CLLocationManager delegate is not getting called in iPhone SDK 4.0 ???

    - by Biranchi
    Hi, This is the code that I have in my AppDelegate Class - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { CLLocationManager *locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = 1000; // 1 Km locationManager.desiredAccuracy = kCLLocationAccuracyKilometer; [locationManager startUpdatingLocation]; } And this is the delegate method i have in my AppDelegate Class //This is the delegate method for CoreLocation - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //printf("AppDelegate latitude %+.6f, longitude %+.6f\n", newLocation.coordinate.latitude, newLocation.coordinate.longitude); } Its working in 3.0, 3.1, 3.1.3 , but its not working in 4.0 simulator and device both. What is the reason ?? I am getting frustrated ...... Thanks....

    Read the article

  • Why does CLLocationManager returns null locations on the iphone SDK 4 beta in the Simulator?

    - by Rigo Vides
    Hi everyone, I have this piece of code: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"Manager did update location!!"); self.currentLocation = newLocation.description; } I have this code inside a class that conforms to the CLLocationManagerDelegate. I tested earlier in sdk 3.0 and works nice (on both simulator and device). I'm testing this class on the SDK 4, in the simulator, but it gives null as a newLocation. I can't even get the NSLog for the first call. I checked other app where I use the location framework and it doesn't work either. I implemented the locationManager:didFailWithError: message also, wich is never called. Can anyone please confirm that the simulator can't do any CLLocationManager capabilities? (a link where the bug is reported as a known issue will be awesome). Is there a way to fix this? Thanks in advance.

    Read the article

  • longitude and latitude for current location returned from CLLocationManager in UK region is not corr

    - by bond
    Hi I am getting latitude and longitude of current location from CLLocationManager delegate method. It works fine for some region but its giving problem in UK region. When it is used in UK region, the current location longitude and latitude returned from CLLocationManager is not proper. Thanks heres a part of the logic i am using. -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.locationManager = [[CLLocationManager alloc] init]; if(self.locationManager.locationServicesEnabled) { self.locationManager.delegate = self; self.locationManager.distanceFilter = kCLDistanceFilterNone; self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; } } -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"Updating"); //if the time interval returned from core location is more than 15 seconds //we ignore it because it might be from an old session if ( abs([newLocation.timestamp timeIntervalSinceDate: [NSDate date]]) < 15) { self.latitude = newLocation.coordinate.latitude; self.longitude = newLocation.coordinate.longitude; NSLog(@"longitude=%f-- latitude=%f--",self.longitude,self.latitude); [self.locationManager stopUpdatingLocation]; [self removeActivityIndicator]; [[self locationSaved] setHidden:NO]; [[self viewLocationInMap] setEnabled:YES]; }}

    Read the article

  • Error: CLLocationManager headingAvailable

    - by Bubu4711
    I have the following code: In my .h-Header-File: #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface Compass : UIViewController <CLLocationManagerDelegate> { [...] CLLocationManager *locationManager; } [...] @property(nonatomic, retain) CLLocationManager *locationManager; @end And my .m-File: #import "[FILENAME].h" [...] @synthesize locationManager; - (void)viewDidLoad { [super viewDidLoad]; self.locationManager = [[[CLLocationManager alloc] init] autorelease]; if(locationManager.headingAvailable == NO) { [...] } [...] } And I get the following error Message for "locationManager.headingAvailable": error:request for member 'headingAvailable' in something not a structure or union I've added the CoreLocation framework to my app... Who can help me?

    Read the article

  • wait for CLLocationManager to finish before tweeting

    - by user295944
    I want to wait for latitude.text and longtitude.text to be filled in before sending a tweet, this code works fine, but I would rather not put the tweeting part in locationManager because I also want to sometimes update the current location without sending a tweet. How can I make sure the txt gets filled in before sending the tweet without doing this? - (IBAction)update { latitude.text =@""; longitude.text =@""; locmanager = [[CLLocationManager alloc] init]; [locmanager setDelegate:self]; [locmanager setDesiredAccuracy:kCLLocationAccuracyBest]; [locmanager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocationCoordinate2D location = [newLocation coordinate]; latitude.text = [NSString stringWithFormat: @"%f", location.latitude]; longitude.text = [NSString stringWithFormat: @"%f", location.longitude]; TwitterRequest * t = [[TwitterRequest alloc] init]; t.username = @"****"; t.password = @"****"; [twitterMessageText resignFirstResponder]; loadingActionSheet = [[UIActionSheet alloc] initWithTitle:@"Posting To Twitter..." delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [loadingActionSheet showInView:self.view]; [t statuses_update:twitterMessageText.text andLat:latitude.text andLong:longitude.text delegate:self requestSelector:@selector(status_updateCallback:)]; twitterMessageText.text=@""; }

    Read the article

  • CLLocationManager class method not calling in iPodTouch

    - by Siddharth
    HI all, I was using a sample code which uses CLLocationManager class to determine the current location of user. when i run this app on iPad i am getting the correct location but when i run the same app on iPod Touch i am getting a blank label i.e nothing is displayed on the label .although wi-fi signal strength is good in both iPod and iPad.The code looks like... - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ int degrees = newLocation.coordinate.latitude; double decimal = fabs(newLocation.coordinate.latitude - degrees); int minutes = decimal * 60; double seconds = decimal * 3600 - minutes * 60; NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; latLabel.text = lat; [latLocationArray addObject:lat]; degrees = newLocation.coordinate.longitude; decimal = fabs(newLocation.coordinate.longitude - degrees); minutes = decimal * 60; seconds = decimal * 3600 - minutes * 60; NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; longLabel.text = longt; [longLocationArray addObject:longt]; }

    Read the article

  • Why call autorelease for iVar definition in init method?

    - by iFloh
    Hi, I just familiarise myself with the CLLocationManager and found several sample class definitions that contain the following init method: - (id) init { self = [super init]; if (self != nil) { self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; } return self; } - (void)dealloc { [self.locationManager release]; [super dealloc]; } I don't understand why the iVar would be autoreleased. Does this not mean it is deallocated at the end of the init method? I am also puzzled to see the same sample codes have the iVar release in the dealloc method. Any thoughts? '

    Read the article

  • CLLocationManager ensure best accuracy for iphone

    - by Zap
    Does anyone have any suggestions on how to obtain the best horizontal accuracy on the location manager? I have set the desired accuracy to NearestTenMeters, but given that the accuracy can always change depending on coverage area, how can I write some code in the locationManager to stop updating only after I get the best horizontal accuracy?

    Read the article

  • iPhone locationManager:didFailWithError problem when GPS disabled

    - by BenG
    So, I've followed other related threads, but for some reason I'm still having this error and I'm about ready to tear my hair out. I have implemented locationManager:didFailWithError to check and see if a user selects 'Don't Allow' to use the current location. -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { NSLog(@"IN ERROR"); if ([error code] == kCLErrorDenied){ [manager stopUpdatingLocation]; } } However, the following error always appears when the user selects 'Don't Allow'...it's strange, especially the order that the text 'IN ERROR' appears. ERROR,Time,293420691.000,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1 2010-04-19 21:44:51.000 testApp[1414:207] IN ERROR So, it's outputting this error even before it has a chance to get into the didFailWithError function. Does anyone have any ideas of what might be happening? The rest of the locationManager code is as follows: self.locationManager = [[[CLLocationManager alloc] init] autorelease]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyKilometer; locationManager.distanceFilter = 2; [locationManager startUpdatingLocation];

    Read the article

  • How to check if location services are enabled for a particular app prior to iOS 4.2?

    - by NobleK
    Hello How can I check if the user has allowed location for mu app? Normally I would use authorizationStatus method of the CLLocationManager class, but it is only available in iOS 4.2 and newer. Is it possible to achieve this somehow while still using SDK 4.2, so that the app can still run on devices with older versions of iOS, or do I have to downgrade the SDK? And along the same line, I need a similar alternative for the locationServicesEnabled method prior to iOS 4.0. Thanx

    Read the article

  • iPhone Problem comparing course value for cllocation

    - by zebra
    hi all, i'm writing some code for getting some values including course -(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //somecode NSString *dirString = [[NSString alloc] initWithFormat:@"%d", newLocation.course]; int myInt = [dirString intValue]; if ((myInt >= 0) || (myint < 90)) {course.text =@ "N";} if ((myInt >= 90) || (myint < 180)) {course.text =@ "E";} and so on, but i always retrieve the first value, "N". where's my mistake? Thank's!

    Read the article

  • How to get coordinates when iPhone is locked/sleeping?

    - by lionfly
    For normal situations, the didUpdateToLocation (of CLLocationManager) does not work any more when the lock/sleep button is pushed, and your app cannot get further newLocation coordinates during the locked period. However, some apps CAN track during the locked period, and they will show the correct route when you unlocked and see the Mapview. Obviously there are ways to get the coordinates during the locked period. How to get the coordinates when the iPhone is locked/sleeping? Who has hints and further info, please post. Thanks.

    Read the article

  • iPhone Development - Location Accuracy

    - by Mustafa
    I'm using following conditions in-order to make sure that the location i get has adequate accuracy, In my case kCLLocationAccuracyBest. But the problem is that i still get inaccurate location. // Filter out nil locations if(!newLocation) return; // Make sure that the location returned has the desired accuracy if(newLocation.horizontalAccuracy < manager.desiredAccuracy) return; // Filter out points that are out of order if([newLocation.timestamp timeIntervalSinceDate:oldLocation.timestamp] < 0) return; // Filter out points created before the manager was initialized NSTimeInterval secondsSinceManagerStarted = [newLocation.timestamp timeIntervalSinceDate:locationManagerStartDate]; if(secondsSinceManagerStarted < 0) return; // Also, make sure that the cached location was not returned by the CLLocationManager (it's current) - Check for 5 seconds difference if([newLocation.timestamp timeIntervalSinceReferenceDate] < [[NSDate date] timeIntervalSinceReferenceDate] - 5) return; When i activate the GPS, i get inaccurate results before i actually get an accurate result. What methods do you use to get accurate/precise location information?

    Read the article

  • Can get coordinates from iPhone simulator, but can't get coordinates from iPhone device

    - by iPhoneARguy
    Hi everyone, I've run into something of a mysterious bug (to me). I have some code to pick out the user's current location on the iPhone SDK. It works fine on the iPhone simulator, but when I try to run it on the actual device, I get a weird error. Here is the code (I am using ASIFormDataRequest to create a POST request): ASIFormDataRequest * request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:@"testauthor" forKey:@"author"]; [request setPostValue:[[NSNumber numberWithDouble:datum.location.coordinate.latitude] stringValue] forKey:@"latitude"]; NSLog(@"%f", datum.location.coordinate.latitude); NSLog(@"%f", datum.location.coordinate.longitude); [request setPostValue:[[NSNumber numberWithDouble:datum.location.coordinate.longitude] stringValue] forKey:@"longitude"]; [request setPostValue:datum.comment forKey:@"comment"]; On the simulator, NSLog does log both the latitude and longitude, but on the iPhone, it does not. Even stranger, when I go through with the debugger on the device, I try "po datum.location", I get <+###, -###> +/- 223.10m (speed 0.00 mps / course -1.00) @ 2010-05-02 22:18:37 -0400 (### replaced by my location) but when I do "(gdb) po datum.location.coordinate" I get: There is no member named coordinate. Do you guys have any idea why this might happen? Thanks in advance for your help!

    Read the article

  • MapKit/Location Manager crashes app when unloading view

    - by AppGolfer
    I has a bug where my application crashed "EXC_BAD_ACCESS" when I hit the back key on my navigation bar and the view unloaded that had a MapKit (mapView) and used the Location Manager. Tried for days to fix the bug and finally came up with a fix for anyone that comes across this problem: Add this code to your dealloc (void)dealloc { mapView.delegate = nil; locationManager.delegate = nil; [mapView release]; [locationManager release];

    Read the article

  • iPhone: Turning latitude/longitude into "major cross-streets"

    - by Gloria
    Using the MKReverseGeocoder or GoogleAPI or MapKit... Is there a simple way to turn a latitude/longitude into "nearest major cross-streets"? A user might not have any idea where "12345 Pineapple" is located... so I want to show something like "Pineapple and Main"... or (larger, major roads) like "US-140 and Hwy 76". I don't really care what "major" is defined as... perhaps any road with higher speed limits... or more than 3 lanes... etc. I don't really care what "close by" is defines as... perhaps within 0-10 miles... or just "closest found".

    Read the article

  • How to get direction information in iPhone application

    - by Buffernet
    Hi, In my app I use the getdistancefrom method in my app and get a distance between a current location and another set location. I would like to as well find the direction the other set location is in. What would the code look like to make this iPhone sdk call. The output would look something like: Location is 500 feet North West Thanks!

    Read the article

1 2 3  | Next Page >