cllocation

Converting CLLocationCoordinate2D to a String that can be stored

被刻印的时光 ゝ 提交于 2019-11-28 04:44:27
问题 I'm trying to save the coordinates of a user while in one ViewController so that it can be used to create an Annotation that can displayed in another ViewController. In the view controller that stores the coordinates I'm using the code NSUserDefaults.standardUserDefaults().setObject( Location, forKey: "Location") In the map view controller that displays the annotation I'm trying to get the coordinates using the code let Location = NSUserDefaults.standardUserDefaults().stringForKey("Location")

CLLocationManager and accuracy issues - any experiences?

ε祈祈猫儿з 提交于 2019-11-28 03:12:44
So I am dealing with some accuracy issues with iPhone GPS. I have an app which uses location. In the delegate method locationManager: didUpdateToLocation: fromLocation: I am being returned a location. From a bit of research, it appears the GPS isn't always accurate on the first result it returns, even when setting desiredAccuracy property to kCLLocationAccuracyBest . In order to get around this, I don't call stopUpdatingLocation before it's returned newLocation: at least 3 times (this is very quick). I have also played around with two other "requirements" for whether to stopUpdatingLocation

Replace blue dot in GMSMapView by an arrow - Swift

大憨熊 提交于 2019-11-27 22:49:33
问题 I use the Google SDK for an application iOS8 (Swift). I want to replace the blue dot (my location) in a GMSMapView by an arrow witch rotate according to the orientation of the smartphone. How can I do that? EDIT : I managed to see my arrow but I have three problems : 1 : The arrow is cut and I do not find as enlarge the area 2 : The position of the arrow is not exactly on my location I solve this problem by delete "0,5" : CGContextTranslateCTM(context, size.width, size.height) 3 : The

Zoom MKMapView to fit polyline points

烈酒焚心 提交于 2019-11-27 19:42:48
I have an array, allCollections, that holds programmatically-created arrays of CLLocations the user has recorded through my iOS app. Each sub-array in allCollections holds all the location points in a trip taken. I draw MKPolylines off of the CLLocations in the arrays in allCollections to represent those trips on an MKMapView. My question is this: With the polylines added to the map, how would I go about programmatically zooming and centering the map to display all of them? fundtimer -(void)zoomToPolyLine: (MKMapView*)map polyline: (MKPolyline*)polyline animated: (BOOL)animated { [map

What do horizontalAccuracy and verticalAccuracy of a CLLocation refer to?

冷暖自知 提交于 2019-11-27 19:37:08
I've been working on a location based app recently and am noticing some strange values for CLLocation. I often get a horizontalAccuracy of 1414 and a verticalAccuracy of -1 . Any clue what this indicates? As far as I can tell, these points are often very accurate. What is the difference between verticalAccuracy and horizontalAccuracy? The -1 for verticalAccuracy indicates that the altitude in the CLLocation is not valid. You only get altitude with a 3D GPS position. The 1414 for horizontalAccuracy indicates that the horizontal (lat/lon) position could be up to 1414m off (this is just an

didUpdateLocations not called

江枫思渺然 提交于 2019-11-27 19:01:09
I'm trying to get my current location, but the break point in didUpdateLocations is never being called. LocationManager: locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager setDesiredAccuracy:kCLDistanceFilterNone]; [locationManager startUpdatingLocation]; Delegate method: - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations; I confirmed that location services and enabled and authorized. Why is the locationManager delegate method not being

Trouble with CLLocation method distanceFromLocation: Inaccurate results

女生的网名这么多〃 提交于 2019-11-27 15:03:42
问题 I am trying to use the distanceFromLocation: method to calculate the total distance that I am walking with my iPhone in my hand. So far, I have been searching all over to help remedy my confusing, inaccurate, and seemingly arbitrary results. In these code snippets, theLabel is just a label object that is present in my app's interface, distanceMoved is the variable that I am trying to store the total distance I walked in, and locMan is a location manager that is declared in my @interface file.

IOS Getting location updates when app terminated without using significantChange

若如初见. 提交于 2019-11-27 14:08:33
I apologise for the redundancy of this topic, but in spite all the given answers, I can't identify the possibility of getting accuracyBest location updates when the app is terminated. I don't want to use monitoringSignificantChange, I want the best possible accuracy; I won't submit the app on the AppStore, so Apple restrictions are not a problem either. I have gone through these: - Location update even when app is killed/terminated - iOS update location even when app is terminated - Working with location updates when app is terminated - http://mobileoop.com/getting-location-updates-for-ios-7

How to calculate speed of our car using iphone

ぐ巨炮叔叔 提交于 2019-11-27 13:13:13
问题 For my application I want to calculate my car/bike speed using iphone. How can i do that? Ideally, it should run continuously in the background. 回答1: CLLocation includes a speed property that will give you the current speed of the device. (Note the comment about the accuracy at that link.) To get the user's current location, follow the steps in the Location Awareness Programming Guide, under "Getting the User's Current Location". Finally, to enable location updates in the background, see

Swift - CLGeocoder reverseGeocodeLocation completionHandler closure

时间秒杀一切 提交于 2019-11-27 11:14:41
问题 What I'm trying to do is pass a CLLocation to the function getPlacemarkFromLocation which then uses the passed CLLocation through reverseGeocodeLocation to set the CLPlacemark? that will be returned. I'm having issues creating the completionHandler closure in reverseGeocodeLocation , it's throwing a compiler error/crash: In Swift, CLGeocodeCompletionHandler is CLGeocodeCompletionHandler = (AnyObject[]!, NSError!) -> Void according to the documentation AnyObject[]! is supposed to contain