core-location

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

佐手、 提交于 2019-11-26 04:22:33
问题 I want to get the current location, but instead I get an error. This is a snippet of my view controller. - (void)viewDidLoad { self.locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; [locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations { // I would get the latest location here // but this

Location permission alert on iPhone with PhoneGap

南楼画角 提交于 2019-11-26 04:19:44
问题 How do you change the string on the alert saying: (Appname/whatever it is) would like to use your current location Of course, I only want to change the appname part. Because when you use the PhoneGap framework, the string is very ugly, something like this: /var/mobile/Applications/157EB70D-4AA7-826E-690F0CBE0F/appname.app/www/index.html Someone having an idea? 回答1: You need to do the geolocation after the device is ready. The following Jquery code, for example, will geolocate without that

Start Location Manager in iOS 7 from background task

混江龙づ霸主 提交于 2019-11-26 03:49:05
问题 It seems that in iOS 7 an app can not start Location Manager (by calling startUpdatingLocation) from the background task anymore. In iOS 6 I used approach described here: https://stackoverflow.com/a/6465280 to run background location update every n minutes. The idea was to run background task with a timer and start Location Manager when the timer triggers it. After that turn off Location Manager and start another background task. After updating to iOS 7 this approach does not work anymore.

How to retrieve user&#39;s current city name?

拥有回忆 提交于 2019-11-26 03:36:40
问题 How do you retrieve the user\'s current city name? 回答1: What you have to do is setup a CLLocationManager that will find your current coordinates. With the current coordinates you need to use MKReverseGeoCoder to find your location. - (void)viewDidLoad { // this creates the CCLocationManager that will find your current location CLLocationManager *locationManager = [[[CLLocationManager alloc] init] autorelease]; locationManager.delegate = self; locationManager.desiredAccuracy =

Set the location in iPhone Simulator

放肆的年华 提交于 2019-11-26 00:58:47
问题 How can I set the location (as it\'s picked up in CoreLocation services) in the iPhone Simulator? 回答1: As of iOS 5, the simulator has a configurable location. Under the Debug menu, the last entry is "Location"; this gives you a sub menu with: None Custom Location Apple Stores Apple City Bicycle Ride City Run Freeway Drive Custom Location lets you enter a Lat/Long value. Bicycle ride, City Run, and Freeway Drive are simulation of a moving location (in Cupertino, of course). Of course, this

Background Location Services not working in iOS 7

允我心安 提交于 2019-11-25 23:54:20
问题 I\'ve recently upgraded my iOS devices to use iOS 7. One of the apps that we\'re developing uses background location services to track device location and all of our testers have reported that the app no longer appears to track in the background under iOS 7. We have verified that backgrounding for the app is enabled in the settings on the device and the previous build worked flawlessly under iOS 6. Even if the device were cycled, the app would restart after a location update. Is there

Periodic iOS background location updates

爷,独闯天下 提交于 2019-11-25 23:38:58
问题 I\'m writing an application that requires background location updates with high accuracy and low frequency . The solution seems to be a background NSTimer task that starts the location manager\'s updates, which then immediately shuts down. This question has been asked before: How do I get a background location update every n minutes in my iOS application? Getting user location every n minutes after app goes to background iOS Not the typical background location tracking timer issue iOS long

How do I get a background location update every n minutes in my iOS application?

筅森魡賤 提交于 2019-11-25 22:26:21
问题 I\'m looking for a way to get a background location update every n minutes in my iOS application. I\'m using iOS 4.3 and the solution should work for non-jailbroken iPhones. I tried / considered following options: CLLocationManager startUpdatingLocation/startMonitoringSignificantLocationChanges : This works in the background as expected, based on the configured properties, but it seems not possible to force it to update the location every n minutes NSTimer : Does work when the app is running

Set the location in iPhone Simulator

梦想与她 提交于 2019-11-25 21:07:36
How can I set the location (as it's picked up in CoreLocation services) in the iPhone Simulator? Robert Altman As of iOS 5, the simulator has a configurable location. Under the Debug menu, the last entry is "Location"; this gives you a sub menu with: None Custom Location Apple Stores Apple City Bicycle Ride City Run Freeway Drive Custom Location lets you enter a Lat/Long value. Bicycle ride, City Run, and Freeway Drive are simulation of a moving location (in Cupertino, of course). Of course, this does nothing to help with debugging for iOS 4 (or earlier); but it's a definite improvement! Run