cllocation

Update property using Geocoder to get user actual address, EXC_BAD_ACCESS

…衆ロ難τιáo~ 提交于 2019-12-24 14:26:03
问题 Im relatively a new iOS developer, and im dealing with the geocoder completion handler , i do not understand how to update a variable with the address find by the geocoder and the do some stuff with it. In few words, i want that the geocoder block finishes to use the info in some method . - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"didUpdateToLocation: %@", newLocation); CLLocation

It is possible that stopRangingBeaconsInRegion stop notifications of a monitored region?

拈花ヽ惹草 提交于 2019-12-23 03:42:12
问题 I'm doing a sample project working with CLLocationManager . I call startMonitoringForRegion . Then, I start to simulate a beacon with other device and didEnterRegion is called. In the didEnterRegion , I call startRangingBeaconsInRegion and works fine. Then, I pause the beacon emitter and didExitRegion is called. In the didExitRegion I call stopRangingBeaconsInRegion . If I start again the beacon emitter, didEnterRegion is not called. I found this in the Apple documentation:

Convert String of CLLocationCoordinate2D(s) into array

﹥>﹥吖頭↗ 提交于 2019-12-23 02:53:07
问题 Updating previous question for better explanation. var breadcrumbs: [CLLocationCoordinate2D] = [] var path: [CLLocationCoordinate2D] = [] This is called every 10 seconds to append a CLLocationCoordinate2D to the array. func addBreadcrumb(){ let speed = (locationmanager.location?.speed)! let speedRounded = speed.roundTo(places: 4) let crumbCoordinate = locationmanager.location?.coordinate breadcrumbs.append(crumbCoordinate!) tripSpeeds.append(speedRounded) } Once the user is done with their

Location timestamp accuracy in ios

最后都变了- 提交于 2019-12-22 17:51:27
问题 After analysing location services in iOS 10, found that some inconsistency is in the caching behaviour. Fetching locations in a periodic time (in my case every 20 secs) returns locations but their timestamps are not in chronologically ordered. This indicates that the caching locations might have issues. So if you are checking accuracy through location-timestamp better to save the previous timestamps also. So that you could decide that the location fetched can be used or not. Below image is

calculating 'timeIntervalSinceNow' with a negative value (CLLocation example)?

狂风中的少年 提交于 2019-12-22 09:19:48
问题 i don't understand this example from the doc : the timeIntervalSinceNow method should show a positive value, but how can we reach "5" as mentioned in the code? (i think it's either 0 more or less, or -10 , -20, -30 etc... but how can we get a positive value such as 5?) : - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { // test the age of the location measurement to determine if the measurement is cached

Convert GPS coordinates to a city name / address in Swift

邮差的信 提交于 2019-12-22 05:25:09
问题 I have a latitude/longitude location that I want to convert to the location name String in Swift. What is the best way to do this? i believe it's best to use the reverseGeocodeLocation function but not exactly sure how to. This is what I have so far: func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) { if (locationFixAchieved == false) { locationFixAchieved = true var locationArray = locations as NSArray var locationObj = locationArray.lastObject as

Convert GPS coordinates to a city name / address in Swift

自作多情 提交于 2019-12-22 05:25:03
问题 I have a latitude/longitude location that I want to convert to the location name String in Swift. What is the best way to do this? i believe it's best to use the reverseGeocodeLocation function but not exactly sure how to. This is what I have so far: func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) { if (locationFixAchieved == false) { locationFixAchieved = true var locationArray = locations as NSArray var locationObj = locationArray.lastObject as

CLLocationManager not working all the time (iOS 8, Xcode 6)

我的未来我决定 提交于 2019-12-21 04:18:33
问题 Basically half the time the delegate method - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations; is not called at all. But the other half of the time it works perfectly! I've found that it usually happens when I first start up Xcode after closing and quitting it, but then after that or a couple runs after that it seems to work fine. I'm not 100% sure if it's just an Xcode problem or what, I'll be getting a developer's license soon so I'll see if it

String to CLLocation latitude and Longitude

扶醉桌前 提交于 2019-12-20 09:00:22
问题 I have two strings representing latitude and longitude like: "-56.6462520", and i want to assign then to a CLLocation object to compare to my current location.I tried the following code but i get errors only: CLLocation * LocationAtual = [[CLLocation alloc]init]; LocationAtual.coordinate.latitude = @"-56.6462520"; LocationAtual.coordinate.longitude = @"-36.6462520"; and then compare the object with my actual location latitude and longitude. Any suggestions? 回答1: I think you need to:

MapKit giving wrong lat & lang - iOS 8

柔情痞子 提交于 2019-12-20 05:57:36
问题 When I try to use map in iOS 8, I get below error. Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first. For this I tried solution from here, but still no luck. Below is what I did. Step 1. Have entry in Info.plist NSLocationWhenInUseUsageDescription - This is test text Step 2. Updated -(CLLocationCoordinate2D) getLocation -