allowsBackgroundLocationUpdates in CLLocationManager in iOS9

This new property is explained in the WWDC session “What’s New in Core Location”. The default value is NO if you link against iOS 9. If your app uses location in the background (without showing the blue status bar) you have to set allowsBackgroundLocationUpdates to YES in addition to setting the background mode capability in … Read more

didUpdateLocations instead of didUpdateToLocation

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 didUpdateLocations:(NSArray *)locations In order to get the last position, simply get the last object of the array: [locations lastObject] … Read more

iOS: App is not asking user’s permission while installing the app. getting kCLAuthorizationStatusNotDetermined every time – Objective-c & Swift

iOS8 has got us major API changes with the LocationsServices Assuming [CLLocationManager locationServicesEnabled] return YES, With the First Launch of the iOS App [both iOS7 and iOS8] – locationMangers(CLLocationManager) authorizationStatus preset to authorizationStatus(CLAuthorizationStatus) = kCLAuthorizationStatusNotDetermined Prompting in iOS7+ Initiate the locationManger (CLLocationManager , Strong) and set the delegates(CLLocationManagerDelegate) Now to prompt the user to use … Read more

Xcode / iOS simulator: Trigger significant location change manually

So two answers: A) Hop on a train 🙂 B) Use the simulator. In iOS 5.x simulator, there is a debug menu that has a location submenu. Choose freeway drive. This will start the simulator on an imaginary journey down the scenic 280 in Northern California. It gives you everything but the view: your app … Read more

Why requestWhenInUseAuthorization doesn’t prompt the user for access to the location?

You probably need to update your plist file. Here’s a tutorial how to do it, quick & dirty: You need to do is to add one of the following keys to your Info.plist file: NSLocationWhenInUseUsageDescription NSLocationAlwaysUsageDescription You also need to request authorization for the corresponding location method, WhenInUse or Background. Use one of these calls: … Read more

didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”

If you are using the simulator: Press command + shift + , in Xcode to open the scheme editor Select the Run scheme Go to the Options tab Check ✅ Allow Location Simulation Select a Default Location in the dropdown Selecting None as your Default Location may have caused the problem.

Behaviour for significant change location API when terminated/suspended?

Since I asked this question, I have done a fair bit of testing (mostly on the train between home and work) and have confirmed that the behaviour for suspended apps is as I suspected at the end of the question. That is, your suspended app is woken up, you don’t receive any callbacks on your … Read more

How can I get current location from user in iOS

The answer of RedBlueThing worked quite well for me. Here is some sample code of how I did it. Header #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface yourController : UIViewController <CLLocationManagerDelegate> { CLLocationManager *locationManager; } @end MainFile In the init method locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; … Read more

Get User’s Current Location / Coordinates

To get a user’s current location you need to declare: let locationManager = CLLocationManager() In viewDidLoad() you have to instantiate the CLLocationManager class, like so: // Ask for Authorisation from the User. self.locationManager.requestAlwaysAuthorization() // For use in foreground self.locationManager.requestWhenInUseAuthorization() if CLLocationManager.locationServicesEnabled() { locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters locationManager.startUpdatingLocation() } Then in CLLocationManagerDelegate method you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)