I am developing a simple ios app in swift that gets the location of the user and shows the location. I need to set this app to target ios 7.0 and higher so iPhone 4 users can use this app. However, when i set the
Deployment Target to 7.0 I get a build error saying:
/Users/toing_toing/dev/xyz/HomePageViewController.swift:35:30: 'requestAlwaysAuthorization()' is only available on iOS 8.0 or newer
It comes from this line:
self.locationManager.requestAlwaysAuthorization()
I need the app to access GPS all the time for the moment, but I cant find a replacement code for this that will fix the deployment target error. What can I do?
Just use
self.locationManager.startUpdatingLocation()