core-location

Is it possible to use Core Location / GPS without any internet connection / disabled cellular network?

青春壹個敷衍的年華 提交于 2019-11-26 09:51:22
问题 I need to capture the GPS coordinates (no reverse geocoding, names, etc) in regions where there is no internet such as on a sailing boat or in the Sahara desert, so that you just get the latitude and longitude of where you are. Does Core Location support that and falls back to GPS-only (no cell triangulation or WiFi location mapping)? I think it does, but just want to be sure. 回答1: Some iOS devices have a real GPS chip allowing you to get location data even with no Internet connection. I

How to get Location user with CLLocationManager in swift?

人盡茶涼 提交于 2019-11-26 09:36:53
问题 I have this code on my view controller but this not working: import UIKit import CoreLocation class ViewController: UIViewController, CLLocationManagerDelegate { var location: CLLocationManager! override func viewDidLoad() { super.viewDidLoad() location=CLLocationManager() location.delegate = self location.desiredAccuracy=kCLLocationAccuracyBest location.startUpdatingLocation() } func locationManager(location:CLLocationManager, didUpdateLocations locations:AnyObject[]) { println(\"locations =

iOS - MKMapView place annotation by using address instead of lat / long

我的梦境 提交于 2019-11-26 09:20:00
问题 I am able to place annotations on my MKMapView by using latitude and longitude, however, my feed coming in that I need to use location for is using street addresses instead of Lat and Long. e.g 1234 west 1234 east, San Francisco, CA ... Would this have something to do with the CLLocationManager ? Has anyone attempted this before? 回答1: Based on psoft 's excellent information, I was able to achieve what I was looking for with this code. NSString *location = @"some address, state, and zip";

iOS Geofence CLCircularRegion monitoring. locationManager:didExitRegion does not seem to work as expected

喜欢而已 提交于 2019-11-26 09:06:44
问题 I am currently trying to get my app to monitor particular regions using CoreLocation however I am finding that it does not seem to work as expected, it seems to me that it cannot work with small a small radius set for each location i.e. 10m. I\'ve also put together a little test app which plots the circle radius on a map so I can visually see what is happening. The code I am using for monitoring locations is as follows: self.locationManager = [[CLLocationManager alloc] init]; self

Calculating bearing between two CLLocationCoordinate2Ds

烂漫一生 提交于 2019-11-26 08:59:31
问题 Very \"simple\" problem: given two CLLocationCoordinate2Ds, how can I get the bearing (as radians) from the first to the second? I\'ve done a lot of research and studying on this, both the general problem and Objective-C/Cocoa Touch/iOS specifically. Here\'s my implementation: - (float) getHeadingForDirectionFromCoordinate:(CLLocationCoordinate2D)fromLoc toCoordinate:(CLLocationCoordinate2D)toLoc { float fLat = fromLoc.latitude; float fLng = fromLoc.longitude; float tLat = toLoc.latitude;

iPhone GPS in background never resumes after pause

旧城冷巷雨未停 提交于 2019-11-26 08:12:54
问题 My application needs to track user location changes in the background and works fine as long as user moves around. When user stops and CLLocationManager pauses after 10-20 minutes or so. It is indicated by this notification: -(void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager{} And this is also fine with me. Great, I save some battery, etc. The problem is that CLLocationManager never wakes up when user starts moving again and following delegate methods are never fired

Is there a way to check if the iOS device is locked/unlocked?

≯℡__Kan透↙ 提交于 2019-11-26 08:06:47
问题 I have used GPS location updates in my application. I want to detect if the iOS device is in sleep mode so that I can turn off the GPS location updates and optimize the battery use. I have already tried pausesLocationupdates in iOS 6, but it does not work as desired. I want to turn off the GPS location updates as soon as the device goes to sleep mode. I want to detect the lock/unlock event in the device. Is there any way to achieve this functionality ? so far I got the darwin notifications as

CLLocation Category for Calculating Bearing w/ Haversine function

妖精的绣舞 提交于 2019-11-26 06:36:02
问题 I\'m trying to write a category for CLLocation to return the bearing to another CLLocation. I believe I\'m doing something wrong with the formula (calculous is not my strong suit). The returned bearing is always off. I\'ve been looking at this question and tried applying the changes that were accepted as a correct answer and the webpage it references: Calculating bearing between two CLLocationCoordinate2Ds http://www.movable-type.co.uk/scripts/latlong.html Thanks for any pointers. I\'ve tried

Behaviour for significant change location API when terminated/suspended?

此生再无相见时 提交于 2019-11-26 06:10:58
问题 This is the section from the CLLocationManager documentation describing the app behavior with 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 dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to

Testing CoreLocation on iPhone Simulator

喜你入骨 提交于 2019-11-26 05:26:06
问题 UPDATE: As of iOS 5 and Xcode 4.1 is is now possible to test location in the simulator and even define routes. See http://developer.apple.com for more details. Legacy Question Is there anyway to test CoreLocation on the iPhone Simulator? All I require is to be able to set the location myself and have CoreLocation return it. 回答1: Here is my simple hack that forces the CLLocationMager to return the geocoords of Powell's Tech Bookstore only on the simulator: #ifdef TARGET_IPHONE_SIMULATOR