cllocationmanager

How to find your current location with CoreLocation

谁说我不能喝 提交于 2019-11-26 12:22:04
问题 I need to find my current location with CoreLocation , I tried multiple methods but so far my CLLocationManager has only returned 0\'s.. ( 0.000.00.000 ). Here\'s my code ( updated to work ): Imports : #import <CoreLocation/CoreLocation.h> Declared : IBOutlet CLLocationManager *locationManager; IBOutlet UILabel *latLabel; IBOutlet UILabel *longLabel; Functions : - (void)getLocation { //Called when needed latLabel.text = [NSString stringWithFormat:@\"%f\", locationManager.location.coordinate

Replacement for “purpose” property of CLLocationManager

ぃ、小莉子 提交于 2019-11-26 11:11:19
问题 In iOS 6, the purpose property of CLLocationManager, to describe the reason for using location services ( @property(copy, nonatomic) NSString *purpose ) has been deprecated. What replacement, if any, is proposed by Apple? 回答1: The replacement for the purpose property in iOS 6 is a new Info.plist key named NSLocationUsageDescription (aka "Privacy - Location Usage Description"). The key is documented in the Information Property List Key Reference but unfortunately it's not mentioned with the

Why the CLLocationManager delegate is not getting called in iPhone SDK 4.0?

若如初见. 提交于 2019-11-26 09:56:45
问题 This is the code that I have in my AppDelegate Class - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { CLLocationManager *locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = 1000; // 1 Km locationManager.desiredAccuracy = kCLLocationAccuracyKilometer; [locationManager startUpdatingLocation]; } And this is the delegate method i have in my AppDelegate Class //This is

IOS 9 Error Domain=kCLErrorDomain Code=0 “(null)”

拟墨画扇 提交于 2019-11-26 09:42:38
问题 Code below should get current location. But above error is generated. Function didUpdateLocations never gets called. Running this on a device (iPhone 5s)iOS 9.1. Info.plist has Required device capabilities and Privacy - Location usage description configured as shown in the attached image. Please help! let locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() locationManager.delegate = self locationManager.requestAlwaysAuthorization() locationManager

How to get Location user with CLLocationManager in swift?

人盡茶涼 提交于 2019-11-26 09:36:53
问题 I have this code on my view controller but this not working: import UIKit import CoreLocation class ViewController: UIViewController, CLLocationManagerDelegate { var location: CLLocationManager! override func viewDidLoad() { super.viewDidLoad() location=CLLocationManager() location.delegate = self location.desiredAccuracy=kCLLocationAccuracyBest location.startUpdatingLocation() } func locationManager(location:CLLocationManager, didUpdateLocations locations:AnyObject[]) { println(\"locations =

iOS - MKMapView place annotation by using address instead of lat / long

我的梦境 提交于 2019-11-26 09:20:00
问题 I am able to place annotations on my MKMapView by using latitude and longitude, however, my feed coming in that I need to use location for is using street addresses instead of Lat and Long. e.g 1234 west 1234 east, San Francisco, CA ... Would this have something to do with the CLLocationManager ? Has anyone attempted this before? 回答1: Based on psoft 's excellent information, I was able to achieve what I was looking for with this code. NSString *location = @"some address, state, and zip";

iOS Geofence CLCircularRegion monitoring. locationManager:didExitRegion does not seem to work as expected

喜欢而已 提交于 2019-11-26 09:06:44
问题 I am currently trying to get my app to monitor particular regions using CoreLocation however I am finding that it does not seem to work as expected, it seems to me that it cannot work with small a small radius set for each location i.e. 10m. I\'ve also put together a little test app which plots the circle radius on a map so I can visually see what is happening. The code I am using for monitoring locations is as follows: self.locationManager = [[CLLocationManager alloc] init]; self

iPhone GPS in background never resumes after pause

旧城冷巷雨未停 提交于 2019-11-26 08:12:54
问题 My application needs to track user location changes in the background and works fine as long as user moves around. When user stops and CLLocationManager pauses after 10-20 minutes or so. It is indicated by this notification: -(void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager{} And this is also fine with me. Great, I save some battery, etc. The problem is that CLLocationManager never wakes up when user starts moving again and following delegate methods are never fired

Get location name from Latitude & Longitude in iOS

醉酒当歌 提交于 2019-11-26 08:11:18
问题 I want to find current location name from latitude and longitude, Here is my code snippet I tried but my log shows null value in all the places except in placemark , placemark.ISOcountryCode and placemark.country I want value of placemark.locality and placemark.subLocality but it is showing null values. - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // this creates the CCLocationManager that will find your current location locationManager = [[CLLocationManager alloc]

How to stop multiple times method calling of didUpdateLocations() in ios

与世无争的帅哥 提交于 2019-11-26 08:08:48
问题 This my code...... -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { location_updated = [locations lastObject]; NSLog(@\"updated coordinate are %@\",location_updated); latitude1 = location_updated.coordinate.latitude; longitude1 = location_updated.coordinate.longitude; self.lblLat.text = [NSString stringWithFormat:@\"%f\",latitude1]; self.lblLon.text = [NSString stringWithFormat:@\"%f\",longitude1]; NSString *str = [NSString stringWithFormat:@\