cllocationmanager

didUpdateLocations instead of didUpdateToLocation

强颜欢笑 提交于 2019-12-28 03:31:10
问题 With the release of iOS6 Apple wants us to use didUpdateLocations instead of didUpdateToLocation. Can anyone explain how to properly use didUpdateLocations? 回答1: I asume you used the following delegate to get the last position? - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation The delegate above is deprecated in iOS 6. Now the following should be used: - (void)locationManager:(CLLocationManager *)manager

how to show Custom user location programmatically

[亡魂溺海] 提交于 2019-12-26 03:09:10
问题 Hey I'm a beginner and learning Ios App development and i want to know that how to set the the user location programmatically like we did here using IDE (Custom Location) :- I setup everything and location system is working fine in my simulator (fake location) what i have to do if i want to do the same thing programmatically i worked myself and found a little solution but its not helping me out like something is missing here's my code :- - (IBAction)showMyLocation:(id)sender { CLLocation

how to show Custom user location programmatically

南楼画角 提交于 2019-12-26 03:09:10
问题 Hey I'm a beginner and learning Ios App development and i want to know that how to set the the user location programmatically like we did here using IDE (Custom Location) :- I setup everything and location system is working fine in my simulator (fake location) what i have to do if i want to do the same thing programmatically i worked myself and found a little solution but its not helping me out like something is missing here's my code :- - (IBAction)showMyLocation:(id)sender { CLLocation

Update CLLocation Manager on another method

瘦欲@ 提交于 2019-12-25 09:25:32
问题 I need to update my location outside the func locationManager I have 2 labels that are being updated every second, and a call to an API from a HTTP POST Request. The problem is when I call the API (when I press the startButton, only the first value is passed :-/ class PressStartViewController: UIViewController,CLLocationManagerDelegate { var manager: CLLocationManager! var userLocation: CLLocation! = nil var timer = NSTimer() var time = 0 var minute = 0 @IBOutlet var bearingLabel: UILabel!

Calculate distance of user's current location and a specific city

最后都变了- 提交于 2019-12-25 08:57:15
问题 I have to get current location of my user and I have done it by using CLLocationManager . I can get user's current city or area. I have an array of cities and have to check that which city is closest to the current location of user. Is it possible and if yes then how I can achieve it. EDIT: I have to show some deals or offers on the basis of user's location. If user is not from the city which is in my list, then I have to find out the nearest city and have to show offers from that city. 来源:

Timer on Location Manager

假装没事ソ 提交于 2019-12-25 05:21:23
问题 Is it possible to invoke didUpdateLocations inside the Timer ? I mean.. _timer = Timer.scheduledTimer(timeInterval: 10, target: self, selector: #selector(_:didUpdateLocations:)), userInfo: nil, repeats: true) Is that going to work ? If yes then it is going to update location every 10 seconds ? 回答1: You can't invoke didUpdateLocations. If you want frequent updates, your best choice is the Standard location service: The standard location service is most appropriate for apps that deliver

Timer on Location Manager

£可爱£侵袭症+ 提交于 2019-12-25 05:21:12
问题 Is it possible to invoke didUpdateLocations inside the Timer ? I mean.. _timer = Timer.scheduledTimer(timeInterval: 10, target: self, selector: #selector(_:didUpdateLocations:)), userInfo: nil, repeats: true) Is that going to work ? If yes then it is going to update location every 10 seconds ? 回答1: You can't invoke didUpdateLocations. If you want frequent updates, your best choice is the Standard location service: The standard location service is most appropriate for apps that deliver

Unit Test CLLocationManager implementation

瘦欲@ 提交于 2019-12-25 04:53:17
问题 I have a class named " GeolocationManager " that handles a CLLocationManager object and delegate responses. - (void)getGeolocationForClient:(id<GeolocationManagerDelegate>)client { _delegate = client; _locationManager = [self createLocationManager]; _locationManager.delegate = self; _locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; [_locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { // do some

How to differentiate between CLCircularRegion and CLBeaconRegion invoking didEnterRegion

喜夏-厌秋 提交于 2019-12-25 03:51:53
问题 My app uses geofencing as well as iBeacon monitoring. I have set up some CLCircularRegion as well as CLBeaconRegion to be monitor. So whenever, i hit a new beacon or new location, then - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { NSLog(@"CLCircularRegion or CLBeaconRegion?, I am confused!!!"); } will be invoked. Can anybody tell me how to find out which region(i.e.,CLCircularRegion/CLBeaconRegion) is calling the delegate. 回答1: Finally found my own

How to get accurate location update when application is killed?

别来无恙 提交于 2019-12-25 03:42:24
问题 I'm developing a location based application where user can stored number of locations and when user passed near by that stored location, application will notify user by local notification. I've used following code to achieve this feature: -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if([[UIApplication sharedApplication] backgroundRefreshStatus] == UIBackgroundRefreshStatusDenied){ [self showAlertWithTitle:@"" andMessage:@"The