Search Results

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

Page 3/3 | < Previous Page | 1 2 3 

  • iPhone SDK: Get GPS coordinates from Google Maps

    - by RaYell
    In an iPhone application I'm developing I need to get GPS coordinates to perform some actions based on the values received. Users should have two possibilities of giving the location: automatically from iPhone build-in GPS by finding a specific point on a map (Google Maps) I know how to user CLLocationManager to get current position coordinates and I know how to add Google Maps using JS API. What I would like to know if how can I get coordinates for a specific point on a map that user clicks. Is that possible with UIWebView or is there any other way of getting the values I need?

    Read the article

  • MKMapView doesn't want to call didAddAnnotationViews method

    - by TheLearner
    I am writing a little map kit app but it doesn't want to call the delegate method didaddannotationviews: (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views { //Get the first MKAnnotationView from the views returned MKAnnotationView *annotationView = [views objectAtIndex:0]; //Get the annotation from the first annotation view and save it in a variable which can hold any object as long as it implements mkannotation id <MKAnnotation> mp = [annotationView annotation]; //Create a region MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate], 250, 250); //As the mapview to animate i.e. display the region [mv setRegion:region animated:YES]; } @interface WhereAmIAppDelegate : NSObject { UIWindow *window; CLLocationManager *locationManager; IBOutlet MKMapView *mapView; IBOutlet UIActivityIndicatorView *activityIndicator; IBOutlet UITextField *locationTitleField; }

    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

  • Core Location Best Placement and User Interruption

    - by b.dot
    Hi All, My application uses Core Location in three different views. It's working perfectly. In my first view, I subclass the CLLocationManager and use protocol methods for location updates to my calling class. Before I install the framework and code in my other classes, I was wondering: Is the protocol method the best way? What happens to the Core Location execution if the user exits the view or quits the app while it's trying to get a location fix? Is the location task terminated with the GPS system turned off immediately? If the user simply switches to another view, is it OK to assume that I can start Core Location in the next view without regard to the last? Where should the first update location call be placed. Should the application delegate instantiate the CLLocation Manager class using protocol so that it can update any of the views chosen or should each class instantiate the manager. Any feedback would be appreciated. Thanks.

    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

  • MKReverseGeocoder delegate location?

    - by fuzzygoat
    I have a quick question regarding memory management that I am not quite sure about. I currently have a locationManager delegate that calls locationManager:didUpdateToLocation:fromLocation when it resolves the device location. My question is I am looking at adding ReverseGeoCoding after I have obtained the [newLocation coordinate] but am unsure about doing the alloc here, as each time locationManager:didUpdateToLocation:fromLocation gets called I will be alloc-ing a new MKReverseGeoCoder? // LOCATION -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { // GeoCoding: MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:[newLocation coordinate]]; [geoCoder setDelegate:self]; [geoCoder start]; [self foundLocation]; } Can anyone point me in the right direction with regards to this? I did try doing the alloc in application:didFinishLaunchingWithOptions: but then realised I did not have access to [newLocation coordinate]. many thanks gary

    Read the article

  • Releasing instance if service not enabled?

    - by fuzzygoat
    I would just like to check if I have this right, I am creating an instance of CCLocationManager and then checking if location services are enabled. If it is not enabled I then report an error, release the instance and carry on, does that look/sound right? locationManager = [[CLLocationManager alloc] init]; BOOL supportsService = [locationManager locationServicesEnabled]; if(supportsService) { [locationManager setDelegate:self]; [locationManager setDistanceFilter:kCLDistanceFilterNone]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager startUpdatingLocation]; } else { NSLog(@"Location services not enabled."); [locationManager release]; } ... ... ... more code cheers gary

    Read the article

  • How i call NSObject method in UIViewController class method?

    - by Rajendra Bhole
    Hi,I am the beginner in iphone development. I develop an application in which i calling some GPS related information(method name is getGPSInformation{}) in clsGPS{} is an pure NSObject class.The code is as follows, import "clsGPS.h" -(void)getGPSInformation { locationManager = [[CLLocationManager alloc ] init]; locationManager.delegate = self; locationManager.distanceFilter = 5.0f; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; [locationManager startUpdatingLocation]; } I want the above method calling in UIViewController class. How i call this method in UIViewController class from that i automatically call this method at application launching time? should i calling that method in viewDidLoad event or viewWillAppear method?

    Read the article

  • getting the value of a filter at an arbitrary time

    - by Andiih
    Context: I'm trying to improve the values returned by the iPhone CLLocationManager, although this is a more generally applicable problem. The key is that CLLocationManger returns data on current velocity as and when it feels like it, rather than at a fixed sample rate. I'd like to use a feedback equation to improve accuracy v=(k*v)+(1-k)*currentVelocity where currentVelocity is the speed returned by didUpdateToLocation:fromLocation: and v is the output velocity (and also used for the feedback element). Because of the "as and when" nature of didUpdateToLocation:fromLocation: I could calculate the time interval since it was last called, and do something like for (i=0;i<timeintervalsincelastcalled;i++) v=(k*v)+(1-k)*currentVelocity which would work, but is wasteful of cycles. Especially as I probably want timeintervalsincelastcalled to be measured as 10ths of a second. Is there a way to solve this without the loop ? i.e. rework (integrate?) the formula so I put an interval into the equation and get the same answer as I would have by iteration ?

    Read the article

  • asyncsocket Write Issue

    - by James
    I am attempting to use asyncsocket to communicate GPS data from a server app on my iPhone to a client app on my macbook. The two devices connect without any problems, and when the first data is sent from the iPhone to the laptop in asyncsocket's didConnectToHost method, the data is sent without hiccup. When I subsequently try to write additional data to the laptop from the locationManager method, however, no data is written. Here is the code: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { lat = [NSNumber numberWithFloat:newLocation.coordinate.latitude]; [lat retain]; NSLog(@"lat: %1.0f", [lat floatValue]); NSString *msg = [NSString stringWithFormat:@"%1.0f", [lat floatValue]]; NSData *msgData = [msg dataUsingEncoding:NSUTF8StringEncoding]; [listenSocket writeData:msgData withTimeout:-1 tag:0]; } listensocket is my instance of ASyncSocket. I know that no data is being sent because after the initial successful transfer, the didWriteDataWithTag method is not called. Can anyone explain this? Thanks! James

    Read the article

  • Placemark not giving city name in ios 6

    - by Sawant
    I am using this code in which i am getting Placemark but it not giving the city name. Earlier i am using MKReverse Geocoder to get the placemark in which i am getting the city name but as in ios6 it showing deprecated because the apple developer added every thing in CLLocation. so i used this code. `-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocation *location = [locationManager location]; NSLog(@"location is %@",location); CLGeocoder *fgeo = [[[CLGeocoder alloc] init] autorelease]; // Reverse Geocode a CLLocation to a CLPlacemark [fgeo reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error){ // Make sure the geocoder did not produce an error // before continuing if(!error){ // Iterate through all of the placemarks returned // and output them to the console for(CLPlacemark *placemark in placemarks){ NSLog(@"%@",[placemark description]); city1= [placemark.addressDictionary objectForKey:(NSString*) kABPersonAddressCityKey]; NSLog(@"city is %@",city1); } } else{ // Our geocoder had an error, output a message // to the console NSLog(@"There was a reverse geocoding error\n%@", [error localizedDescription]); } } ]; } ` here as i am seeing in console in NSLog(@"%@",[placemark description]); its giving output like :- abc road name,abc road name, state name,country name. any help please .Thanking in advance.

    Read the article

  • cancelPreviousPerformRequestWithTarget is not canceling my previously delayed thread started with pe

    - by jmurphy
    Hello, I've launched a delayed thread using performSelector but the user still has the ability to hit the back button on the current view causing dealloc to be called. When this happens my thread still seems to be called which causes my app to crash because the properties that thread is trying to write to have been released. To solve this I am trying to call cancelPreviousPerformRequestsWithTarget to cancel the previous request but it doesn't seem to be working. Below are some code snippets. - (void) viewDidLoad { [self performSelector:@selector(myStopUpdatingLocation) withObject:nil afterDelay:6]; } (void)viewWillDisappear:(BOOL)animated { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(myStopUpdatingLocation) object:nil]; } Am I doing something incorrect here? The method myStopUpdatingLocation is defined in the same class that I'm calling the perform requests. A little more background. The function that I'm trying to implement is to find a users location, search google for some locations around that location and display several annotations on the map. On viewDidLoad I start updating the location with CLLocationManager. I've build in a timeout after 6 seconds if I don't get my desired accuracy within the timeout and I'm using a performSelector to do this. What can happen is the user clicks the back button in the view and this thread will still execute even though all my properties have been released causing a crash. Thanks in advance! James

    Read the article

  • Open Maps app from Code : Where to find the "Current Location"?

    - by Simon
    I am opening Maps app to show directions from user's Current Location to a destination coordinate, from my code. I am using the following code to open the Maps app. I am calling this code when a button is pressed. - (void)showDirectionsToHere { CLLocationCoordinate2D currentLocation = [self getCurrentLocation]; // LINE 1 NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", destCoordinate.latitude + 0.1, destCoordinate.longitude, destCoordinate.latitude, destCoordinate.longitude];//8.3, 12.1 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; } Here [self getCurrentLocation] in LINE 1 uses CLLocationManager to determine the Current Location and returns the value. Note: I have not yet implemented the LINE1. I've just planned to do in that way. My question is, Is this a good practice to calculate the Current Location, at the time the Maps app is called? [self getCurrentLocation] will retrun the Current Location before openURL gets called? I have to determine the Current Location well before opening the Maps app? I am little bit confused about these things. Kindly guide me. Thanks.

    Read the article

< Previous Page | 1 2 3