cllocationmanager

to run app continuously in the background

狂风中的少年 提交于 2019-11-27 23:13:45
I want to my app to keep running in the background with location services. For this I have used: -(void)applicationDidEnterBackground:(UIApplication *)application { [locationManager stopUpdatingLocation]; [locationManager startUpdatingLocation]; //timer=[NSTimer scheduledTimerWithTimeInterval:300 target:self selector:@selector(UpdateLocation) userInfo:nil repeats:YES]; } but when I use NSTimer it does not call UpdateLocation . I tried calling it using another method but then it also called only once. I want to run the app continuously in the background, detecting locations after regular

significant location change does not trigger on device

拜拜、爱过 提交于 2019-11-27 22:23:36
问题 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,

Reverse Geocode Location in Swift [closed]

别说谁变了你拦得住时间么 提交于 2019-11-27 19:05:23
My input is a latitude and longitude. I need to use the reverseGeocodeLocation function of swift, to give me the output of the locality. The code I have tried to use is println(geopoint.longitude) println(geopoint.latitude) var manager : CLLocationManager! var longitude :CLLocationDegrees = geopoint.longitude var latitude :CLLocationDegrees = geopoint.latitude var location: CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude) println(location) CLGeocoder().reverseGeocodeLocation(manager.location, completionHandler: {(placemarks, error) -> Void in println(manager.location)

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

How to prompt user to turn on Location Services…again

ε祈祈猫儿з 提交于 2019-11-27 18:50:59
I want to have the same functionality as the Map app, where user is prompted every time they press the 'current location' button to turn on their Location Services if they are off: Turn off location services User presses 'getCurrentLocation' button App tries to get location using CLLocationManager User gets 'Turn On Location Services..." message that shows "Settings" and "Cancel" buttons. User taps 'Cancel' User presses ''getCurrentLocation' button again App tries to get location using CLLocationManager again User does not get 'Turn On Location Services..." message any more In the Map app, the

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

最后都变了- 提交于 2019-11-27 18:03:33
问题 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

didEnterRegion works in foreground but not background or other VCs

余生颓废 提交于 2019-11-27 16:35:24
问题 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

locationServicesEnabled test passes when they are disabled in viewDidLoad

与世无争的帅哥 提交于 2019-11-27 15:09:15
问题 I have location services disabled for my application in the settings panel. I run a test in viewDidLoad in my view controller to see if they are enabled: if([CLLocationManager locationServicesEnabled]) { //Do something now } This test always passes for some reason. If I try and access location services I get a kCLErrorDenied error for the location manager. What gives? Am I using the wrong test? 回答1: The locationServicesEnabled class method only tests the global setting for Location Services.

Locationservice Indicator stays “on”

人走茶凉 提交于 2019-11-27 15:07:42
问题 I have a created a small app which uses location services on the iPhone. All works well, except the fact, that sometimes, the small arrow in the info-bar stays active even if I explicitly kill the app. I use the background mode for locationservices, thus the appDelegate methods applicationWillResignActive , applicationDidEnterBackground , applicationWillEnterForeground and applicationDidBecomeActive are implemented but do not touch the location services (well - I need them in background mode)

Region Monitoring Glitch on iOS 7 - Multiple Notifications at the same time

有些话、适合烂在心里 提交于 2019-11-27 14:31:46
I have been developing region monitoring on iOS for about 2 months. Recently we have found a glitch where all the regions within a certain radius (about 4.7KM or 4700 meters) triggered at the same time. The current location of the device is not even close to any of the regions. I am not sure what could have triggered that event. I have searched through StackOverFlow, Apple Developer forums and etc, I haven't find any similar issue with what I am facing. In the app that I am developing, we are monitoring 8 regions within the City (Kuala Lumpur). On one instance, my colleague found out that