Tag: cllocationmanager

iBeacons:如何获得广播信标功率(txPower)

iBeacons似乎在计算beacon.accuracy和beacon.proximity属性(在这里可以find关于iBeacon通告数据包的详细信息)中使用它们的txPower参数(报告1米距离的RSSI功率)。 但是, CLBeacon类似乎没有txPower的属性。 有没有一种方法可以使用Core Location框架获得txPower,还是需要我去核心蓝牙? 我需要这个的原因是,我想试验自定义信标准确度/接近度计算,以实现非常快的信标立即范围发现。 在这种情况下,从accuracy反向计算txPower不是帮手。

如何在iOS模拟器中禁用系统位置警报

我使用KIF框架( http://github.com/kif-framework/KIF )与Xcode持续集成服务器进行UItesting。 当iOS模拟器系统警报“应用程序想要使用您的当前位置”时,XCode CI服务器启动应用程序出现。 我使用这个代表 – (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus: (CLAuthorizationStatus)status 获取用户允许使用位置的通知,我需要它保持原样。 是否有可能在KIF系统上点击OK? 我没有find方法。 或者如何让模拟器中的应用程序使用位置服务而不显示此警报?

CLLocationManager坐标

我一直在努力实施步行,骑自行车和驾驶的路线图。 但是,正如你在下面的屏幕截图中所看到的那样,即使我没有走路/骑自行车或者驾驶那个位置,我的坐标也会不时跳跃。 这个圆圈已经画在图像上来指出这个问题。 我的问题是为什么所有的突然坐标跳转? 这是我的实现快照: – (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CoordinateModel *coord = [[CoordinateModel alloc] init]; coord.latitude = newLocation.coordinate.latitude; coord.longitude = newLocation.coordinate.longitude; ActivityType currentActivityType = [DataManager sharedInstance].activityType; if (currentActivityType == 0) { // walking [appDelegate.walkingCoordinates addObject:coord]; } else if(currentActivityType == 1) { [appDelegate.bikingCoordinates addObject:coord]; } else if(currentActivityType == 2) { // driving […]

didUpdateLocations永远不会调用swift

我试图获取用户的位置。 为此,我在info.plist中设置了以下属性: 我也在我的viewDidLoad方法以及下面的函数中添加了下面的代码。 问题是locationManager(manager, didUpdate….)函数永远不会被调用,我也永远不会被提示权限访问位置,即使我已经删除并重新安装了应用程序。 我正在iPad上testing,而不是在模拟器上。 didFailWithError函数永远不会被调用。 self.locationManager.delegate = self self.locationManager.desiredAccuracy = kCLLocationAccuracyBest self.locationManager.requestWhenInUseAuthorization() self.locationManager.startUpdatingLocation() func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { print("UPDATING") let locValue:CLLocationCoordinate2D = manager.location!.coordinate let latitude = locValue.latitude let longitude = locValue.longitude latitudeText = "\(latitude)" longitudeText = "\(longitude)" if let a = latitudeText, b = longitudeText { print(a) print(b) self.locationManager.stopUpdatingLocation() if (userAlreadyExist()) […]

didEnterRegion和didRangeBeacons之间的区别

didEnterRegion和didRangeBeacons在用例方面有什么区别,我的意思是当我应该实现didEnterRegion / didExitRegion和什么时候应该实现didRangeBeacons? 每个委托方法的确切function是什么? 从苹果的文档,这不是很清楚。 – (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { } 和 – (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region { }

startMonitoringForRegion实际上是否工作?

我一直在尝试使用startMonitoringForRegion,但遇到问题以捕获进入/退出事件。 当我在模拟器上启动应用程序并移动到我指定的位置时,我得到1个input事件,但input从未再次触发的事件。 有人可以让我知道,如果我做得对吗? test.h #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface EWViewController : UIViewController<CLLocationManagerDelegate> { CLLocationManager *locman; } @end test.m – (void)viewDidLoad { if(locman == nil) locman = [[CLLocationManager alloc]init]; locman.delegate = self; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(37.787359, -122.408227); CLRegion *region = [[CLRegion alloc]initCircularRegionWithCenter:coord radius:1000.0 identifier:@"SF"]; [locman startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyKilometer]; [super viewDidLoad]; // Do any additional setup after loading […]

一段时间后CLLocationManager didUpdateToLocation不会被调用

我试图logging一段时间的用户位置。 如果用户在移动它工作正常,委托方法didUpdateToLocation调用可靠。然而,如果用户是静止的,应用程序在后台运行,那么一段时间后,不再调用委托方法。 要重新启动它,应用程序需要被购买到前台。 一旦它被激活,委托方法被再次可靠地调用。 我最初认为这可能是由于CLLocationManager对象是在ViewController中声明的,所以我将其更改为在AppDelegate中声明,但这也没有帮助。 我也尝试了distanceFilter属性无济于事。 我目前正在使用View控制器中的以下代码进行设置。 请注意,对象本身是在AppDelegate对象中声明和初始化的。 app.locationManager.delegate = self; app.locationManager.desiredAccuracy = kCLLocationAccuracyBest; app.locationManager.distanceFilter = kCLDistanceFilterNone; [app.locationManager startUpdatingLocation]; 有没有人遇到这个问题? 任何指针将不胜感激。 现在我已经挣扎了好几天了。

iPhone:核心位置popup式问题

当我在iphone中安装我的应用程序并运行第一次然后它要求用户许可核心位置服务。 这里是模拟器的图像。 在我的应用程序中,我的第一个应用程序视图需要当前位置,并根据位置列出了一些事件。 如果应用程序无法获取位置,则会显示默认的事件列表。 所以,我想知道是否有可能持有的应用程序stream程,直到用户点击“ Don't allow ”或“ ok ”button? 我知道如果用户点击“不允许”,那么kCLErrorDenied错误将被解雇。 目前会发生什么,如果用户没有点击任何button,应用程序将显示带有默认列表(无位置)的列表页面。 之后,如果用户点击“ ok ”button,然后没有任何反应! 如何在“ ok ”button单击后刷新页面? 谢谢…。

locationManager:didUpdateLocations:总是被调用几次

当视图确实出现时,我开始更新当前位置,并且在调用locationManager:didUpdateLocations:时停止更新位置。 但为什么locationManager:didUpdateLocations:总是被多次调用? 我错过了什么? #import "ViewController.h" @interface ViewController (){ CLLocationManager *locationManager; // location manager for current location } @end @implementation ViewController – (void)viewDidLoad { [super viewDidLoad]; } – (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self startUpdatingCurrentLocation]; } – (void)startUpdatingCurrentLocation { if (!locationManager) { locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; locationManager.distanceFilter = 10.0f; // we don't need to […]

是iPhone模拟器能够显示标题和纬度,经度?

我正在使用iphone模拟器4.2,并尝试显示或NSLog标题和其他位置服务的属性,如经度,纬度,高度,水平精度,VerticalAccuracy,速度。 但它没有显示正确的参数和标题,实际上并没有发射事件。 作为它的执行CLLocation代码 – (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { [self.delegate locationUpdate:newLocation]; } 而不执行CLHeading代码 – (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { [self.delegate headingUpdate:newHeading]; } 当我在这两个代码上放置断点时,它永远不会触及CLHeading代码。 我正在更新init中的位置和标题。 – (id) init{ if (self!=nil) { self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; self.locationManager.distanceFilter = kCLDistanceFilterNone; [self.locationManager startUpdatingLocation]; [self.locationManager startUpdatingHeading]; } return self; } […]