Home > database >  (From an old xcode project) How can I enable location service?
(From an old xcode project) How can I enable location service?

Time:10-31

I have an old xcode project from iPhone4 and iPhone3GS era. It uses location service.

When I run the app, it seems it does not get locations. Even it does not ask "it uses your current locastion. do you allow it?"

How can I enable location service? Note: it did not have any problems to get locations on iPhone3GS.

Thank you very much! Have a nice weekend :)

Xcode 14.0.0.

CodePudding user response:

Everything could be found in CoreLocation: https://developer.apple.com/documentation/corelocation

You'll need user permission (of course) and you could want to match location with movements. If this is the case, also look for CoreMotion: https://developer.apple.com/documentation/coremotion/

EDIT: Most certain you are using deprecated API's... check for different methods and ways to manage location and motion then what you are doing before.

CodePudding user response:

Thank you very much for your reply. I found the answer here: How can I get current location from user in iOS

In iOS 8 the permission should be explicitly asked before starting to update location:

Code: if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) [self.locationManager requestWhenInUseAuthorization];

This solved my problem. Thank you very much!

Hope this helps someone with the same problem when compiling an old Xcode geolocation application. :)

  • Related