cllocationmanager

GPS location/Region monitoring recap + how to switch on/off the gps signal (icon) in background [iOS]

限于喜欢 提交于 2019-12-13 05:22:47
问题 I'l like to know A) if it's possible to completely switch off the use of gps when the App is in background mode and I terminate it (long press on "home button", tap on the "X" of the corresponding task), even if "region monitoring" is active and there is the corresponding active flag in the App .plst . Also I'd like to recap how you can monitor the device location; I think there are three ways: - [locationManager startUpdatingLocation] - [locationManager

EDSunriseSet returning 0

别等时光非礼了梦想. 提交于 2019-12-13 02:22:59
问题 I am using the EDSunriseSet class from https://github.com/erndev/EDSunriseSet I have the code: if(longitude == 0 && latitude == 0){ longitude = 51.50722; latitude = -0.12750; } EDSunriseSet *sunrise = [EDSunriseSet sunrisesetWithTimezone:[NSTimeZone localTimeZone] latitude:latitude longitude:longitude]; NSLog(@"With lat = %f and long = %F; sunrise is at: %@",latitude,longitude,sunrise.localSunset); and it returns: <NSDateComponents: 0x10a2743a0> Hour: 0 Minute: 0 Second: 0 Is the issue on my

why CLLocationManager always returns true?

北战南征 提交于 2019-12-13 00:33:18
问题 I am using [CLLocationManager locationServicesEnabled] function to get the status whether location service is enabled or not. I kept code in viewDidLoad method. if(![CLLocationManager locationServicesEnabled]) { NSLog(@"No"); } else { NSLog(@"Yes"); } When I am running this app first time it returns Yes . Why? It should return me No . This is the case when I did not select "Allow" or "Don't allow" options. Means I neither allow nor don't allow but in viewDidLoad I got Yes . Now I select "Don

Using freeway drive/ city run in iOS simulator in background mode

喜你入骨 提交于 2019-12-12 23:55:14
问题 I am trying to make use of the options within iOS simulator : debug->freeway drive/ city run in order to simulate the location updates. In my code I am using CLLocationManager for getting location updates with following code: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; [locationManager setDesiredAccuracy

RequestStateForRegion after startMonitoringForRegion in Swift

倖福魔咒の 提交于 2019-12-12 16:40:00
问题 When I start monitoring a region like locationManager.startMonitoringForRegion(tGeoFence[wert][wert2]) and try to determine if it is already entered right after that like this: for region in locationManager.monitoredRegions { if let cireg = region as? CLCircularRegion { if cireg.identifier == tGeoFence[wert][wert2].identifier { locationManager.requestStateForRegion(cireg) } } } doesn't work, cause the registration of the region is not finished when the 2nd part of the code is executed.

Does CLLocationManager works without internet?

纵然是瞬间 提交于 2019-12-12 09:33:27
问题 Silly question !! Though I want to know that is it possible that CLLocationManager works without Internet ????? i.e. iPhone is not connected to internet at all 回答1: iPhoneiPadDev's answer is slightly wrong: whilst sometimes the location manager will fail, it can work without network connectivity. If you want to see this for yourself, go for a drive somewhere with terrible or nonexistent cellular reception: GPS will still work. It very much depends on the environmental conditions around you,

Apple rejection because UIBackgroundMode = location

醉酒当歌 提交于 2019-12-12 08:22:52
问题 I submitted an app which tracks the user's location (and sends it to the server) at some fixed intervals chosen by the user (5 min, 10 min, 30 min, 1 h). The app should work in background, too (sending the requests) and I have declared it as UIBackgroundMode = location . I am able to send the requests while in background at those fixed intervals. Apple rejected it, suggesting the following: We found that your app uses a background mode but does not include functionality that requires that

recieving location updates after app is terminated

▼魔方 西西 提交于 2019-12-12 07:13:50
问题 I need to keep track of the user location all the time (but not drain the battery). I understand the only way to get updates after app is terminated is using startMonitoringSignificantLocationChanges. From Apple's Location Awareness Programming Guide on startMonitoringSignificantLocationChanges: If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options

get alert for current location every time

吃可爱长大的小学妹 提交于 2019-12-12 05:49:14
问题 I am trying to get device current location using CLLocationManage . I set my method to get location on button click. I can get location successfully but when I get alertview with message " APPNAME would like to use your current location? " with two buttons, " Dont Allow " and " Ok ". and I click on "Dont Allow". Then whenever I click on button and I cant get that alertview again to get current location, so I am not able to get the location. So is it possible to get alertview everytime when I

Update user's location in background (iOS)

瘦欲@ 提交于 2019-12-12 03:54:39
问题 I'm building an app that takes the user's location and checks if he's near one of his friend's house (all the friends addresses are stored in NSMutableArray from his contact list), if he is, it sends him a push notification. Now, I'm trying to figure out how I can get the user's location when the app is in the background (and even after the user killed the app from the multitasking screen). I need to analyze his location and check if he is near one of the addresses on the array. Does anybody