cllocationmanager

CLLocationManager startUpdatingLocation not working

喜你入骨 提交于 2019-11-29 10:10:46
So now I'm at least getting callbacks with the following code... - (void)viewDidLoad { [super viewDidLoad]; mapView=[[MKMapView alloc] initWithFrame:self.view.frame]; //mapView.showsUserLocation=TRUE; mapView.delegate=self; [self.view insertSubview:mapView atIndex:0]; NSLog(@"locationServicesEnabled: %@", [CLLocationManager locationServicesEnabled] ? @"YES":@"NO"); CLLocationManager *newLocationManager = [[CLLocationManager alloc] init]; [newLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [newLocationManager setDistanceFilter:kCLDistanceFilterNone]; [self setLocationManager

What does horizontalAccuracy exactly mean?

别来无恙 提交于 2019-11-29 08:10:06
问题 I am working on an iOS application using location services. Having a background in experimental physics, I am wondering what exactly horizontalAccuracy in a location found in locationManager:didUpdateToLocation:fromLocation: stands for. The documentation is a bit sparse... I assume that the accuracy gives a confidence interval based on a gaussian (or poisson?) distribution. Thus, with a certain probability, the actual position is within a circle with a radius of horizontalAccuracy , but could

iOS 9 how get locations even if app terminated

喜欢而已 提交于 2019-11-29 08:04:41
I understand how retrieve locations in background. And I understand that there is a chance to get locations even if terminated Continious location updates even if app is terminated in iOS But. I have app Moves and Foursquare. If this app even not running (I terminate all apps and no apps running) and then I go to 'Privacy' and change for this apps locations to disable (Never), I can see that arrow in status bar disappeared. But when I enable location updates (Always), arrow again appeared in status bar and apps not running in this moment. So this apps begin take info about locations. How? Even

CLLocationCoordinate2D to CLLocation

[亡魂溺海] 提交于 2019-11-29 05:28:39
i have the following loop in my viewDidLoad: for(int i=1; i<[eventsArray count]; i++) { NSArray *componentsArray = [[eventsArray objectAtIndex:i] componentsSeparatedByString:@","]; if([componentsArray count] >=6) { Koordinate *coord = [[Koordinate alloc] init]; coord.latitude = [[componentsArray objectAtIndex:0] floatValue]; coord.longtitude = [[componentsArray objectAtIndex:1] floatValue]; coord.magnitude = [[componentsArray objectAtIndex:2] floatValue]; coord.depth = [[componentsArray objectAtIndex:3] floatValue]; coord.title = [componentsArray objectAtIndex:4]; coord.strasse =

significant location change does not trigger on device

无人久伴 提交于 2019-11-29 04:26:25
I am using significant location change monitoring. When I run the code in the simulator and check Freeway option I get periodic location updates. I grab these updates and save them in NSUserDefaults and than update tableview every 10s, so I can see if I got any updates. If I run the app on a real device, I get zero updates. I kept the phone in my pocket and travelled over 80km, been in 2 cities. Zero updates. Not sure if I messed something up. I am attaching the code. The code is copy paste, feel free to test. Just make sure to use TableViewController in storyboard and set cell id to ID. What

Geofencing iOS 6

孤人 提交于 2019-11-29 04:15:03
问题 I am creating an app that tells the user whether they are near the destination. I am calculating the distance between the currentLocation and the destination. I'm doing the calculation inside the didUpdateLocations . It is working but I've seen that there are methods that can deal with that without the need of doing any math. I am registering the region in the CLLocationManager ; however it seems that the methods didExitRegion and didEnterRegion are not been called. Here are the part of the

Store CLLocationCoordinate2D to NSUserDefaults

一笑奈何 提交于 2019-11-29 04:02:36
I am new to iphone development, and i want to store CLLocationCoordinate2D object to NSUserDefaults . I am Trying [defaults setObject:location forKey:@"userLocation"]; But it gives error 'Sending CLLocationCoordinate2D to parameter of incompatible type id' So How to store CLLocationCoordinate2D into NSUserDefaults ? Thanks. As pdrcabrod said, "A default object must be a property list, that is, an instance of NSData , NSString , NSNumber , NSDate , NSArray , or NSDictionary ." I use this to store, NSNumber *lat = [NSNumber numberWithDouble:location.latitude]; NSNumber *lon = [NSNumber

Blue banner '%MyApp% is Using Your Location' for app that uses location services only when active

▼魔方 西西 提交于 2019-11-29 03:59:48
In my app I'm updating user location every time when app becomes active. I stop CLLocationManager once updated location is received or in applicationWillResignActive: . In Info.plist there is a NSLocationWhenInUseUsageDescription with appropriate description. If app is activated and then immediately moved to background, blue banner saying that '%MyApp% is Using Your Location' appears for less then a second. This banner gets hidden as soon applicationWillResignActive: is called. I've noticed the same problem in Google Maps, but not in Apple Maps. Is there a way to get rid of this banner

didEnterRegion works in foreground but not background or other VCs

限于喜欢 提交于 2019-11-29 02:19:19
If the app is running and the CLLocationManagerDelegate class is the foreground (i.e. visible) then the didEnterRegions triggers and I get both the NSLog as well as the AlertView. However, I get nothing when the app is in the background or, essentially, if the screen is showing anything but the delegate class. I have set "App registers for location updates" under "Required background modes" in the plist although I'm not sure that's even necessary. Here's what I think is the relevant code although I may be wrong (and will gladly add more). I should note that everything in viewDidLoad is wrapped

Rotate GMSMarker in direction at which user facing

走远了吗. 提交于 2019-11-29 01:06:22
问题 I have requirement like on my current location one view will display. It will rotate if device was rotate or location will be change.I research lot but got all the code which have a fix location or angle at some location but i haven't fix location. Can anyone drive me at right direction. I also used rotation property of the GMSMarker but it is not working. - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { if (newHeading.headingAccuracy < 0){ NSLog