core-location

Can I test Significant-Change with Xcode simulator?

寵の児 提交于 2019-12-05 15:13:13
问题 I wonder if I could test Significant-Change location service (startMonitoringSignificantLocationChanges method ) in Xcode Simulator or it just only works in actual device. Notice, I already tried it in Simulator and it didn't work, but I'm not sure if this only because it don't work on simulator or because I did something wrong. Thanks 回答1: I've answered this question before on SO, and using the simulator is not an accurate way to test for -startMonitoringSignificantLocationChanges. This

NSSortDescriptor - sort by location

笑着哭i 提交于 2019-12-05 13:40:27
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 comparator:^NSComparisonResult(Stops *obj1, Stops *obj2) { CLLocation *currentLocation = locationManager

Re-enable iPhone Simulator location services

旧街凉风 提交于 2019-12-05 13:18:34
I have disabled location services on the simulator with the "Don't ask again" option set, thinking that I could re-enable it later, but now I can't find out how. Can someone point me out where to change this setting? Thanks. Solution: System Preferences > Security > (Button) Reset Warnings You may need to click the lock in the bottom left side before you can click that button. I did this and it worked: iOS Simulator > Reset Contents and Settings... That deleted the apps installed in the simulator but also the settings for the GPS, well, and everything else. I was able to reenable the gps after

Am I right in saying initWithNibName:bundle is used to manually load nib files and that initWithCoder would be used as an alternative?

折月煮酒 提交于 2019-12-05 13:10:57
I can't use initWithNibName:bundle seeing as I'm now using the latest XCode (5). After some research I found an alternative: initWithCoder. Example: - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self){ // code here } return self; } What I'm trying to understand is how this is an alternative to initWithNibName? Currently studying with a big nerd ranch book for ios which was written for ios6 and previous versions of xode and experimenting with the coreLocation framework. In the code below I've replaced the initWithNibName. I also done this in an earlier

Is there any performance penalty for using multiple CLLocationManager instances

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 12:26:52
问题 I have at least two controllers in my app that currently use their own CLLocationManager instance. I'm curious however if using multiple instances actually imposes any additional burden on the phone - beyond the additional memory for the different instances. Will the iPhone ping the GPS hardware multiple times, or does it use some sort of dispatch such that the hardware is abstracted and just forwarded to all listeners? I was about to write my own abstraction layer to handle multiple

iOS 6 Map doesn't zoom with MKUserTrackingModeFollow

夙愿已清 提交于 2019-12-05 12:23:49
While my iOS6 MKMapView is in MKUserTrackingModeFollowWithHeading or MKUserTrackingModeFollow , zoom gestures (pinch, double-tap, two-finger tap) work sometimes, but not always. The issue seems to occur when didUpdateUserLocation: is called after regionWillChangeAnimated and before regionDidChangeAnimated . Any ideas on how to fix this? To isolate the problems, I've created a Single View Application with an MKMapView and a UIToolbar (set up in a .xib), to which I'm adding a MKUserTrackingBarButtonItem . The UIViewController acts as a <MKMapViewDelegate> . Here's the complete implementation

Core Location keeps asking for permission

戏子无情 提交于 2019-12-05 12:00:22
I could have sworn that the expected behavior for the core location permission dialog is something like this: if the user clicks "Yes", it will not be shown again if the user clicks "No", it is shown one more time, the next time the app launches. If the user clicks "No" a second time, it will not be shown again. What I'm actually seeing is the following: the user has to click "Yes" twice in a row for that preference to be remembered no matter how many times the user clicks "No", that preference is not remembered Did I just imagine the first expected behavior, or did it change at some point

Disabling allowsBackgroundLocationUpdates (CLLocationManager) doesn't work after is was enabled

允我心安 提交于 2019-12-05 11:55:16
My Application works with continuous background location updates. Of course it has all the permissions and other stuff like allowsBackgroundLocationUpdates = true Initially I wanted to react to LowPowerMode changes while in background using NSProcessInfoPowerStateDidChange notification. And to disable allowsBackgroundLocationUpdates to stop updating locations without calling stopUpdatingLocation . However, I found out that after receiving the notification and setting allowsBackgroundLocationUpdates = false in background application is going on working. So I went farther and identified, that

What is the fastest way to sort a lot of locations on distance?

邮差的信 提交于 2019-12-05 10:05:53
I want to sort lots of locations (waypoints) on their distance from the current location. The current location is, of course, a moving target, so for every location update, recomputing the distance for every location is necessary. But only recomputing for close-by locations would by enough. I currently use core-data, and store the distance to the current location as an attribute in the table (but only update is when it is changed) from within the configurecell: atindexpath: method. That sort of works, but the application is not responding while core-data automagically is updating all distances

iPhone SDK: Do I need to ask user for permissions to use GPS?

南笙酒味 提交于 2019-12-05 09:08:00
In my iPhone application I need to use GPS (CoreLocation to be exact) to get current position of the device. I know that most (if not all) applications using GPS have a popup implemented asking the user to allow GPS access. Is that done automatically by the iPhone SDK or should I implement such functionality myself? I've tried to run my app on iPhone Simulator and it didn't ask for permissions at all so I'm wondering if the same thing will happen on the actual phone. And if I implement that itself and the SKD provides that out-of-the-box then I'll have two confirmation in my app which I don't