Search Results

Search found 35 results on 2 pages for 'corelocation'.

Page 1/2 | 1 2  | Next Page >

  • Get CoreLocation Update before TableView population?

    - by Clemens
    hi, i have the corelocation stuff in an uitableview controller. i actually want to get a distance from two locations and print that distance in a tableview cell. the problem is, that the tableview is filled before all the corelocation stuff happens. how can i make corelocation makes all updates before the table is filled? heres my class: // // EntriesListViewController.m // OEAW_App // // Created by Clemens on 6/6/10. // Copyright 2010 MyCompanyName. All rights reserved. // import "EntriesListViewController.h" import "EntryDetailController.h" @implementation EntriesListViewController @synthesize locationManager; @synthesize delegate; NSMutableDictionary *entries; NSMutableDictionary *dictionary; CLLocation *coords; /- (id) init { self = [super init]; if (self != nil) { self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; } return self; }/ (CLLocationManager *)locationManager { if (locationManager != nil) { return locationManager; } locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; locationManager.delegate = self; return locationManager; } (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //coords.longitude = newLocation.coordinate.longitude; //coords.latitude = newLocation.coordinate.latitude; coords = newLocation; NSLog(@"Location: %@", [newLocation description]); } (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { NSLog(@"Error: %@", [error description]); } (void)viewDidLoad { //[[MyCLController alloc] init]; //[locationManager startUpdatingLocation]; [[self locationManager] startUpdatingLocation]; //---initialize the array--- //entries = [[NSMutableArray alloc] init]; //---add items--- //NSString *Path = [[NSBundle mainBundle] bundlePath]; //NSString *DataPath = [Path stringByAppendingPathComponent:@"Memorials.plist"]; dictionary = [[NSDictionary alloc] initWithContentsOfURL:[NSURL URLWithString: @"http://akm.madison.at/memorials.xml"]]; /*NSDictionary *dssItem = [dictionary objectForKey:@"1"]; NSString *text = [dssItem objectForKey:@"text"]; */ //entries = [[NSMutableDictionary alloc] init]; NSLog(@"%@", dictionary); //Path get the path to MyTestList.plist NSString *path=[[NSBundle mainBundle] pathForResource:@"Memorials" ofType:@"plist"]; //Next create the dictionary from the contents of the file. NSDictionary *dict=[NSDictionary dictionaryWithContentsOfFile:path]; //now we can use the items in the file. // self.name.text = [dict valueForKey:@"Name"] ; NSLog(@"%@",[dict valueForKey:@"Name"]); //---set the title--- self.navigationItem.title = @"Türkendenkmäler"; [super viewDidLoad]; } (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [dictionary count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... NSArray *keys = [dictionary allKeys]; id key = [keys objectAtIndex:indexPath.row]; NSDictionary *tmp = [dictionary objectForKey:key]; NSString *name = [tmp objectForKey:@"name"]; cell.textLabel.text = name; cell.font = [UIFont fontWithName:@"Helvetica" size:12.0]; CLLocation *location = [[CLLocation alloc] initWithLatitude:[[tmp valueForKey:@"coords_x"] floatValue] longitude:[[tmp valueForKey:@"coords_y"] floatValue]]; /*CLLocation *newLoc = [[CLLocation alloc] initWithLatitude:coords.latitude longitude:coords.longitude];*/ //locationController = [[MyCLController alloc] init]; int distance = [coords distanceFromLocation:location]; NSLog(@"%@",distance); cell.detailTextLabel.text = [NSString stringWithFormat:@"%@m",distance]; //NSLog(@"%@", [getLocation newLoc]); return cell; } (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { EntryDetailController *detailViewController = [[EntryDetailController alloc] initWithNibName:@"EntryDetailController" bundle:nil]; //detailViewController.entrySelected = [dictionary objectAtIndex:indexPath.row]; NSArray *keys = [dictionary allKeys]; id key = [keys objectAtIndex:indexPath.row]; NSDictionary *tmp = [dictionary objectForKey:key]; NSString *name = [tmp objectForKey:@"name"]; detailViewController.entrySelected_name = name; NSString *location = [tmp objectForKey:@"location"]; detailViewController.entrySelected_location = location; NSString *type = [tmp objectForKey:@"type"]; detailViewController.entrySelected_type = type; NSString *slug = [tmp objectForKey:@"slug"]; detailViewController.entrySelected_slug = slug; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } (void)dealloc { [entries release]; [super dealloc]; } @end

    Read the article

  • iPhone Development: CoreLocation and MapKit

    - by Mustafa
    How bad is it to use Location Manager to retrieve the location information when MapView.showUserLocation is also TRUE? I have a situation where i want to show the blue dot to indicate the user's current location, and i want to record the user's current location after some time interval. Having said that, there may be situations where the user's current location is now being shown, but i still want to get the user's current location. I think i'll have to use the Location Manager in my controller class, but setting showUserLocation = YES would mean that i'll be draining more battery since two Location Managers are working at the same time? Is this assumption correct?

    Read the article

  • Mac CoreLocation Services does not ask for permissions

    - by Ryan Nichols
    I'm writing a Mac App that needs to use CoreLocation services. The code and location works fine, as long as I manually authenticate the service inside the security preference pane. However the framework is not automatically popping up with a permission dialog. The documentation states: Important The user has the option of denying an application’s access to the location service data. During its initial uses by an application, the Core Location framework prompts the user to confirm that using the location service is acceptable. If the user denies the request, the CLLocationManager object reports an appropriate error to its delegate during future requests. I do get an error to my delegate, and the value of +locationServicesEnabled is correct on CLLocationManager. The only part missing is the prompt to the user about permissions. This occurs on my development MPB and a friends MBP. Neither of us can figure out whats wrong. Has anyone run into this? Relevant code: _locationManager = [CLLocationManager new]; [_locationManager setDelegate:self]; [_locationManager setDesiredAccuracy:kCLLocationAccuracyKilometer]; ... [_locationManager startUpdatingLocation]; UPDATE: Answer It seems there is a problem with Sandboxing in which the CoreLocation framework is not allowed to talk to com.apple.CoreLocation.agent. I suspect this agent is responsible for prompting the user for permissions. If you add the Location Services Entitlement (com.apple.security.personal-information.location) it only gives your app the ability to use the CL framework. However you also need access to the CoreLocation agent to ask the user for permissions. You can give your app access by adding the entitlement 'com.apple.security.temporary-exception.mach-lookup.global-name' with a value of 'com.apple.CoreLocation.agent'. Users will be prompted for access automatically like you would expect. I've filed a bug to apple on this already.

    Read the article

  • best way to use CoreLocation across multiple views

    - by Matt
    I have two views in my app, one is a general view where CoreLocation works away calculating the users location while the user is doing other stuff in the view. The second view is accessed by the user when they touch a button allowing them to locate themselves more accurately using a mapview and MapKit, i would like the mapview in this view to show the location that CoreLocation has already identified in the first view AND to continue displaying this location based on updates from CoreLocation in the other view. Is the best way here to create a singleton that encapsulates the CoreLocation stuff and have this referenced in the view with the map, or to use notifications ? or to use some other better practice for my scenario ? Thanks

    Read the article

  • NotificationCenter Widget Failed To Use CoreLocation

    - by James Ye
    I'm writing a notification center widget, and it had to use location information. In normal apps I use CoreLocation and it works fine. But in my widget, I tried to locationServicesEnabled but it didn't go to the callback functions, and the authorizationStatus is always kCLAuthorizationStatusNotDetermined, and the authorize setting didn't show up in Setting - location service. I already set the delegate to the class. The system's Yahoo weather widget can auto locating and it uses CoreLocation too, so the widget do have ability to use location service. Why CoreLocation doesn't work on my widget?

    Read the article

  • CoreLocation on iPod Touch, location caching and other conundrums...

    - by Moshe
    I have a few questions about Core Location. 1) Should the user refuse permission for my app to use core location, or core location is unavailable for some reason, is there a fallback? (Device Locale, for example?) 2)Can I cache a device's location for next time? Does Core Location do this itself? 3)I really need the sunset time in the user's area during the mid-spring season and I have a function to do that, once I have the Latitude and Longitude of the device. Perhaps I can just make an assumption about the time based on Locale? (Example: In the US, assume approximately 7:00pm.)

    Read the article

  • current location from CoreLocation

    - by Christian
    I have an App which launches the google Map App. The code is: UIApplication *app = [UIApplication sharedApplication]; [app openURL:[[NSURL alloc] initWithString: @"http://maps.google.com/maps?daddr=Obere+Laube,+Konstanz,+Germany&saddr="]]; The saddr= should be the current location. I get the current location with -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"%f,%f", [newLocation coordinate]); The Log displays the correct coordinates like 2010-04-05 15:33:25.436 deBordeaux[60657:207] 37.331689,-122.030731 I didn't find the right way to transmit the coordinates to the url-string. Does someone can give me a hint how-to?

    Read the article

  • Setting corelocation results to NSNumber object parameters

    - by Dan Ray
    This is a weird one, y'all. - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocationCoordinate2D coordinate = newLocation.coordinate; self.mark.longitude = [NSNumber numberWithDouble:coordinate.longitude]; self.mark.latitude = [NSNumber numberWithDouble:coordinate.latitude]; NSLog(@"Got %f %f, set %f %f", coordinate.latitude, coordinate.longitude, self.mark.latitude, self.mark.longitude); [manager stopUpdatingLocation]; manager.delegate = nil; if (self.waitingForLocation) { [self completeUpload]; } } The latitude and longitude in that "mark" object are synthesized parameters referring to NSNumber iVars. In the simulator, my NSLog output for that line in the middle there reads: 2010-05-28 15:08:46.938 EverWondr[8375:207] Got 37.331689 -122.030731, set 0.000000 -44213283338325225829852024986561881455984640.000000 That's a WHOLE lot further East than 1 Infinite Loop! The numbers are different on the device, but similar--lat is still zero and long is a very unlikely high negative number. Elsewhere in the controller I'm accepting a button press and uploading a file (an image I just took with the camera) with its geocoding info associated, and I need that self.waitingForLocation to inform the CLLocationManager delegate that I already hit that button and once its done its deal, it should go ahead and fire off the upload. Thing is, up in the button-click-receiving method, I test see if CL is finished by testing self.mark.latitude, which seems to be getting set zero...

    Read the article

  • CLLocation is not nil but trying to print it out throws EXC_BAD_ACCESS

    - by nefsu
    Sorry, this may be a noob question but I'm working with CoreLocation and this has be stumped. I'm looking up the currentLocation using a singleton that was recommended on this site and when I get the currentLocation object, it returns true to a not nil check. However, when I try to print out its description, it throws EXC_BAD_ACCESS. //WORKS Current location 8.6602e-290 NSLog(@"Current location %g",currLoc); //DOESN'T WORK NSLog(@"Current location %@",[currLoc description]); //DOESN'T WORK - Is this causing the description to fail as well? NSLog(@"Current location %g",currLoc.coordinate.latitude); Why am I able to see something on the first one but not the others? BTW, this is being run on a 3.1.2 simulator Thanks.

    Read the article

  • Core Location - fallback, location caching and alternatives...

    - by Moshe
    I have a few questions about Core Location. 1) Should the user refuse permission for my app to use core location, or core location is unavailable for some reason, is there a fallback? (Device Locale, for example?) 2)Can I cache a device's location for next time? Does Core Location do this itself? 3)I really need the sunset time in the user's area during the mid-spring season and I have a function to do that, once I have the Latitude and Longitude of the device. Perhaps I can just make an assumption about the time based on Locale? (Example: In the US, assume approximately 7:00pm.)

    Read the article

  • MKReverseGeocoder server returned error: 503

    - by raaz
    Hi all, Currently i am developing an iPhone application where i have to show user's current city and location for which i am using Mapkit Framework.When i build the application it works fine and show me the exact city details .But right now when i try to build the application again application shows following error message in my log /SourceCache/ProtocolBuffer_Sim/ProtocolBuffer-26/Runtime/PBRequester.m:523 server returned error: 503 reverseGeocoder: didFailWithError:Error Domain=PBRequesterErrorDomain Code=6001 "Operation could not be completed. (PBRequesterErrorDomain error 6001.)" Is any body facing the same issue and how can i resolve it?

    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

  • Core Location question....

    - by Moshe
    This tutorial on mobileorchard.com uses 2 classes (or 2 sets of .h and .m) to implement core location. Can I just use everything there in my existing class? How would I do that? Also, is the - (id) init { self = [super init]; if (self != nil) { self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; // send loc updates to myself } return self; } method the same as the usual initWithNib? I;m trying to quickly implement something based on location information. As much help describing the above linked tutorial would be helpful. Thanks. No - really, Thank You.

    Read the article

  • Calculation route length

    - by Paul Peelen
    Hi, I have a map with about 80 annotations. I would like to do 3 things. 1) From my current location, I would like to know the actual route distance to that position. Not the linear distance. 2) I want to be able to show a list of all the annotations, but for every annotation (having lon/lat) I would like to know the actual route distance from my position to that position. 3) I would like to know the closest annotation to my possition using route distance. Not linear distance. I think the answer to all these three points will be the same. But please keep in mind that I don't want to create a route, I just want to know the distance to the annotation. I hope someone can help me. Best regards, Paul Peelen

    Read the article

  • iPhone link to map directions using string "current location" not lat and lng for saddr

    - by Nick
    I know there are numerous questions about how to construct a sharedApplication link to the maps app specifying the start and end address with coordinates. I've got that working no problem. Has anyone found a way to link with a source address generically specified as "current location". I ask because the scenario I'm working on having Core Location or a UIMapView would only be necessary in order to determine the user location prior to handing off to the map app where the user locating would seem to just happen again. I've tried throwing UTF8'd "Current Location" and "[Current Location]" into the saddr parameter which amusingly starts from Current Montana. I've also tried simply excluding the saddr param. I know this is often tread territory but this particular situation wasn't covered by anything I found searching here or on mapki. Before I add the core location code I just wanted to make sure there wasn't a more limited way to tackle this. Thanks

    Read the article

  • MKAnnotations are being made successfully, however they sometimes fail to render on MKMapView

    - by jtkendall
    I'm working on an iPhone app using the 3.1.3 SDK, my app finds the users current location, displays it on a MKMapView and then finds nearby locations and renders them as MKAnnotations. My code is working, however sometimes the nearby annotations do not appear on the map. They are still being made as I see the correct data in the console (from NSLog which runs just after the annotations are made). When it fails is completely random, it could be the 5th time I've hit "Build and Run" for the day, or the 500th it doesn't appear to have any pattern and doesn't throw any type of error, it just doesn't add the annotations to the MapView. This is the method called for each nearby location to add the MKAnnotation. - (void)addPinsWithLocation:(NSDictionary *)spot { CLLocationCoordinate2D location; location.longitude = [[spot objectForKey:@"spot_longitude"] doubleValue]; location.latitude = [[spot objectForKey:@"spot_latitude"] doubleValue]; PlaceMarks *placemark = [[PlaceMarks alloc] initWithCoordinate:location title:[spot objectForKey:@"spot_name"] subtitle:@""]; NSLog(@"Adding Pin for Location: '%@' at %f, %f", [spot objectForKey:@"spot_name"], location.latitude, location.longitude); [mapView addAnnotation:placemark]; } Any ideas on how to get MKAnnotations to always show?

    Read the article

  • iphone simulator crashes when it tries to access user location

    - by kevin Mendoza
    for some reason my code causes my program to crash. does anyone know why or how to fix it? NSLog(@"here"); CLLocation *location = [locationManager location]; [mapView removeAnnotations:mapView.annotations]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; CLLocationCoordinate2D workingCoordinate = [location coordinate]; NSLog(@" this is %@", workingCoordinate.latitude); it makes it to the first NSLog, but somewhere between the first and second it crashes. My guess is that it has to do with the CLLocation *location line.

    Read the article

  • How do I get the users location latitude and longitude?

    - by kevin Mendoza
    I need to access the users location in this method contained in the mainViewController -(void)loadAnnotations{ [mapView removeAnnotations:mapView.annotations]; CLLocationCoordinate2D workingCoordinate; workingCoordinate.latitude= //here i need the users latitude workingCoordinate.longitude= //here i need the users longitude NSLog(@" this is %@", workingCoordinate.latitude); iProspectLiteAnnotation *tempMine = [[iProspectLiteAnnotation alloc] initWithCoordinate:workingCoordinate]; [tempMine setTitle:@"Present Location"]; [tempMine setAnnotationType:iProspectLiteAnnotationTypeUser]; [mapView addAnnotation:tempMine]; } however the mainViewController is already set to <fipsideViewControllerDelegate> What should I add to the header file and the implementation file to poll the location Manager for the users current latitude and longitude?

    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

1 2  | Next Page >