core-location

using CLLocation objects as keys in dictionary

谁说我不能喝 提交于 2019-12-05 07:55:21
Is it possible to use CLLocation objects as keys in a dictionary? When I try this, the [dictionary objectForKey: clLocationObj] always returns nil even when there are CLLocation keys already inserted with exactly the same latitude and longitude. What could I be doing wrong? for (Location *location in someArray) { CLLocation *locationKey = [[CLLocation alloc] initWithLatitude:[location.latitude doubleValue] longitude:[location.longtitude doubleValue]]; LocationAnnotation *annotationAtLocation = [self.uniqueLocations objectForKey:locationKey]; if (annotationAtLocation == nil) NSLog(@"this is

How to set the location in the iOS simulator without writing code?

和自甴很熟 提交于 2019-12-05 07:05:33
My problem was how to set the gps location of my app when running in the iOS simulator The home screen in my app displays sunrise and sunset times based on gps location and I wanted a screen shot with sensible values - I'm in the UK and the sunrise times were showing UK times for American sunrise and sunset. As it is on the launch screen one solution, going to Debug -> Simulate Location, is too late for me. Took me a while to work out and I wasn't finding the answer when I searched here (maybe not asking the question the right way . So I'm going to answer my own question below in the hope it

Understanding background tracking of user's location in iOS

梦想的初衷 提交于 2019-12-05 04:50:09
问题 I need to keep getting user's location updates when app going to background and, as I found in Apple's documentation, this is one of the long-running background tasks that are allowed to be implemented. I also need to make some processing and network calls to send to server some info when location updates are notified. What I'm trying to do, in broad strokes, is something like this: - (void)applicationDidEnterBackground:(UIApplication *)application { bgTask = [application

What is the difference between MKCoordinateSpan and CLLocationCoordinate2D

风格不统一 提交于 2019-12-05 04:32:32
I was going through the sample example of MapKit and CoreLocation framework. I found these two structs ( MKCoordinateSpan and CLLocationCoordinate2D ) which are similar in declaration. How are these different in functionality, can someone please site an example (using both) to clear their meanings. Thanks! MKCoordinateSpan defines a span , i.e. a delta, in the latitude and longitude directions to show on a map. Along with a point you can then define a region to display on a map. CLLocationCoordinate2D defines a single point in the latitude and longitude coordinate system. For example: |<----

iPhone SDK: Track users location using GPS

人盡茶涼 提交于 2019-12-05 04:21:24
问题 I have a few questions about CoreLocation and GPS. First, what method in core location is used to continually get the users current coordinates? And at what interval should these be retrieved? Second, should these coordinates be pushed into a NSMutableArray each time they are received, so that the array of coordinates will represent the users path? Thanks, just wanting to get started getting me mind around this. 回答1: A very abbreviated version: First, adopt the <CLLocationManagerDelegate>

Disable location service in iPhone simulator?

这一生的挚爱 提交于 2019-12-05 04:14:45
I'd like to test what happens if my app can't get the location coordinates. Is it possible to disable the location service in the simulator, like on an iPod Touch with WiFI turned off? I still don't have my iPhone Developer Program certificate, so I can't test it on my device. Thanks in advance! As a workaround you can try to simulate update location failure by constructing NSError object with appropriate values and calling corresponding CLLocationManager delegate didFailWithError: method manually. You can disable the location services in the simulator; Run your app through xcode so the

Creating GPX file from array of CLLocation

ぃ、小莉子 提交于 2019-12-05 03:35:51
My application needs to share array of CLLocations (Route) within devices using application.I have no experience of using GPX before this. Is GPX is best format to do it? How can I create GPX file from given such array of CLLocations? and is there standard GPX parser in Objective C? From what I have searched on net and SO answer to these questions are respectively 1.cant say 2. I have seen some webpages converting data of points in GPX format but could not find how they are doing it. 3. No I will be happy if I get alternate answers/views. I understand that these are lot of questions. Any help

Compiler error: Invalid library file - CoreLocation

谁都会走 提交于 2019-12-05 03:34:41
I have one of my application, that is created in Xcode 8. I have used CoreLocation and MapKit in that app. I have update app with latest iOS till now. and it was working fine. Now I am updating application with iOS 1 . So I hvae opened app with Xcode 11.0 and updated all the required code. Also updated setting that is suggested by Xcode "Perform Changes" and all that. Now I run application, but I am getting error like : Compiler error: Invalid library file . I have searched lot, but can't find any solution. Is this a bug in new Xcode or new iOS ? Is there anything I have to do extra changes or

iOS 6 CoreLocation does not work

南笙酒味 提交于 2019-12-05 02:54:27
问题 I make a location app. But Core Location does not work. I tested other iPhone application on my iPhone. Like google earth, a navigation software. The other applications do not work also. Why doesn't update location? Why 'locationManager:didUpdateToLocation:fromLocation:' message called 2 times only? Maybe... My iPhone broken down? or iOS 6 CoreLocation frameworks have some bug? Location service - On on iPhone settings Info.plist armv7 accelerometer location-services gps microphone

monitoringDidFailForRegion when regioning for iBeacon, kCLErrorDomain error 5

不羁岁月 提交于 2019-12-05 02:22:52
问题 I am working on a simple App that uses CoreLocation in iOS7.1 to determine a pre-set iBeacon. My Code did work very well until it suddenly stopped. I didn't change anything in the code. The Error occured was "kCLErrorDomain error 5" on "monitoringDidFailForRegion" after start monitoring on "ViewDidLoad": self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"0E82E0A4-03FF-4A92-9C87-1F978917BD51"]; self