core-location

locationManager:didEnterRegion and didExitRegion are never getting called :iBeacon

那年仲夏 提交于 2019-12-23 02:56:27
问题 While testing with beacons (ios devices) i found the listener beacon giving some unexpected behavior. locationManager:didEnterRegion method is not getting called even if a beacon enters a region. But the locationManager:didRangeBeacons:inRegion: is getting called correctly, and detected beacons are shown there. - (void)startListening{ self.locationManager = [[CLLocationManager alloc] init]; [self.locationManager setDelegate:self]; NSUUID *myProximityUUID = [[NSUUID alloc] initWithUUIDString

How to calculate distance using accelerometer using iphone sdk?

梦想与她 提交于 2019-12-22 16:58:15
问题 What is the best way to calculate the distance between two points/Or we can say while we walk calculate distance traveled using accelerometer? My main question is that i'm working on an application in which i need to count distance using two locations but sometimes the core locations fails to update location so at that time how do i calculate the distance traveled? 回答1: You can't even get an accurate measurement of velocity from the accelerometer, so you're definitely not going to be able to

startMonitoringForRegion not always adding regions to monitoredRegions

风流意气都作罢 提交于 2019-12-22 15:51:57
问题 I can not get startMonitoringForRegion to consistently add regions. int i =0; for(Deals *d in deals){ NSLog(@"deal addRegionsInDealsArray %@",d.deal_id); if (d.latitude != NULL && d.longitude!=NULL && ![d.latitude isEqualToNumber:[NSNumber numberWithInt:0 ]] && ![d.longitude isEqualToNumber:[NSNumber numberWithInt:0 ]]) { CLLocationCoordinate2D dl = CLLocationCoordinate2DMake( [d.latitude doubleValue], [d.longitude doubleValue]); //NSLog(@"Lat addRegionsInDealsArray %@",d.latitude); CLRegion

NSSortDescriptor - sort by location

元气小坏坏 提交于 2019-12-22 09:11:21
问题 I have a list of geographical locations in Core Data (entity name is "Stops"). I want to sort them by the current location, so I can show the user which locations are nearby. I'm using an NSFetchedResultsController so that the results can be easily displayed in a UITableView. I am using the following code to attempt this sort: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"stop_lat" ascending:YES

Region monitoring beacon regions in background not working

人走茶凉 提交于 2019-12-22 06:42:03
问题 I have a problem with region monitoring while the app is in background. Region enters and exits get called if the app is in foreground, but doesn't while in the background (sometimes they fire but very rarely). How does beacon region monitoring work for iOS 8.1.1 ? Should region enters/exit fire instantly when in Beacon proximity while in background ? What should I do to make sure it works ? Do Background Modes : Location Updates or Uses Bluetooth LE accessories have to be on for background

iOS App Background Location (Push Notifications)

痞子三分冷 提交于 2019-12-22 01:16:49
问题 I face an issue where my app requires the users location when they receive a push notification while the app is running in the background. After doing a bit of reading I'm under the impression that this isn't possible, i.e: 1) App in background 2) Push notification received 3) Get users location and execute block of code. I found this post on here that suggests you can run a task every N amount of minutes to get the users location. So using this I could check say every ten minutes which would

how to trap the location alert response iphone

雨燕双飞 提交于 2019-12-21 20:38:54
问题 I am using GPS in iphone and it show conformation message for use location service. and i want to trap what user select "Allow" or "No". can any one suggest how i do this? Thank 回答1: You don't get a direct callback from this alert. However, if the user does not allow Core Location usage, you'll receive a -locationManager:didFailWithError: with a kCLErrorDenied error to your CLLocationManagerDelegate . Since iOS 4.2, you can also listen to -locationManager:didChangeAuthorizationStatus: or

How to ask permission from user for second time to allow to access the current location?

浪子不回头ぞ 提交于 2019-12-21 18:36:14
问题 In my app, if the user not allowed to access their current location, I can recieve that message in the following method - (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)anError { switch([anError code]) { case kCLErrorLocationUnknown: break; case kCLErrorDenied: { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Access Denied" message:@"You didn't allow to access your current location" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert

How do startMonitoringSignificantLocationChanges and startUpdatingLocation effect one-another?

ぐ巨炮叔叔 提交于 2019-12-21 07:02:51
问题 What happens if I call startUpdatingLocation while startMonitoringSignificantLocationChanges is running? Does significantLocationChange monitoring get stopped? If I then stopUpdatingLocation will significantLocationChange monitoring continue or restart? I can find no documentation covering the interplay between these two ways of monitoring location. 回答1: They are not meant to be used concurrently. It's either or as they both deliver heading and location changes to the same delegate method.

iOS CoreLocation checking CLLocation timestamp to use it

回眸只為那壹抹淺笑 提交于 2019-12-21 05:51:46
问题 How do you check a CLLocation object and decide whether you want to use it or discard the result and get a new location update instead? I saw the timestamp property on CLLocation, but I'm not sure how to compare that to the current time. Also, after I do compare the time and find the difference in seconds, what value should the difference be under for me to use that CLLocation object? What's a good threshold. Thanks! 回答1: Is really important to check the timestamp, because iOS usually caches