草庐IT

cllocationmanager

全部标签

iphone - CLLocationManager 如何在飞行模式开启时获取位置

我的应用使用CLLocationManager从设备获取位置更新。我曾假设当设备处于飞行模式时,我不会获得位置更新。但是我愿意。我认为这是因为Apple表示飞行模式会关闭Wifi、蜂窝网络、蓝牙和GPS。请参阅:http://support.apple.com/kb/ht1355那么,我如何获得一个坐标似乎合理的位置更新? 最佳答案 我开发了一个大量使用用户位置的应用程序,因此我必须检查这种情况和其他情况。我了解到,当所有服务(蓝牙、Wi-Fi、手机数据)都关闭时CLLocationManager返回最新的已知位置,因此,在这种情况

ios - iOS 8 中的 CLLocationManager 故障排除

根据新的变化,我更新了CLLocationManager的代码,并添加了NSLocationAlwaysUsageDescription和NSLocationWhenInUseUsageDescription键。manager=[[CLLocationManageralloc]init];manager.delegate=self;manager.distanceFilter=kCLDistanceFilterNone;manager.desiredAccuracy=kCLLocationAccuracyBest;NSLog(@"%d",[CLLocationManagerauthor

ios - Google Places API 未按预期工作

我正在关注GooglePlacesAPIforIOS查看用户当前位置的教程。我在教程中使用了相同的代码如下:varplacesClient:GMSPlacesClient!//AddapairofUILabelsinInterfaceBuilder,andconnecttheoutletstothesevariables.@IBOutletweakvarnameLabel:UILabel!@IBOutletweakvaraddressLabel:UILabel!overridefuncviewDidLoad(){super.viewDidLoad()placesClient=GMSPl

ios - startMonitoringForRegion 与 CLRegion :containCoordinate

在我的IOS应用程序中,我正在实现地理围栏。在当前的实现中,我使用的代码如下:CLRegion*region3=[[CLRegionalloc]initCircularRegionWithCenter:coordinatesradius:100identifier:@"region3"];[self.locationManagerstartMonitoringForRegion:regiondesiredAccuracy:kCLLocationAccuracyHundredMeters];然后我使用这些委托(delegate)方法:(void)locationManager:(CLLo

ios - 从用户位置查找数组中最近的经度和纬度

我有一个包含经度和纬度的数组。我的用户位置有两个双变量。我想测试我的用户位置与我的阵列之间的距离,以查看哪个位置最近。我该怎么做?这将得到2个位置之间的距离,但很难理解我将如何针对一系列位置对其进行测试。CLLocation*startLocation=[[CLLocationalloc]initWithLatitude:userlatitudelongitude:userlongitude];CLLocation*endLocation=[[CLLocationalloc]initWithLatitude:annotation.coordinate.latitudelongitude

IOS 8 CLLocationManager 问题(授权无效)

#import"MyLocationViewController.h"#defineNSLog(FORMAT,...)printf("%s\n",[[NSStringstringWithFormat:FORMAT,##__VA_ARGS__]UTF8String]);@interfaceMyLocationViewController()@end@implementationMyLocationViewController{CLLocationManager*locationManager;}-(void)requestAlwaysAuthorization{[locationMana

ios - 检查是否启用推送或启用位置 ios sdk

我正在使用以下代码来检测这两个(推送通知和定位服务)[postvarssetObject:([CLLocationManagerlocationServicesEnabled])?@"true":@"false"forKey:@"locationServicesEnabled"];BOOLpushEnabled=[[UIApplicationsharedApplication]isRegisteredForRemoteNotifications];[postvarssetObject:(pushEnabled)?@"true":@"false"forKey:@"pushServices

objective-c - 计算两组坐标之间的距离(NSStrings)

我有两组地理坐标,我正在尝试计算它们之间的距离。我已经做了一些挖掘,但无法弄清楚该怎么做。我正在尝试获取用户(userLatitude/userLongitude)和地点(placeLatitude/placeLongitude)之间的距离(以英里为单位)。我的坐标存储为NSStrings,如下所示。有谁知道如何做到这一点?谢谢你们!NSString*userLatitude=[(PDCAppDelegate*)[UIApplicationsharedApplication].delegategetUserLatitude];NSString*userLongitude=[(PDCAp

ios - 两点坐标之间的角度以相应地旋转图像

我有两个CLLocationCoordinate2D点,假设我的mapView上有A和B。我想要一个箭头图像从一个点指向另一个点(A->B)。我无法找到transformarrow-image的正确角度。请参阅此图片以供引用提前致谢。 最佳答案 这是一个老问题,但也许它仍然可以帮助看这里的人:CGFloatangle=atan2f(point2.y-point1.y,point2.x-point1.x);CGAffineTransformrotationTransform=CGAffineTransformIdentity;rota

ios - CLLocationManager 委托(delegate)方法 didUpdateToLocation 未被调用

我有以下代码来获取我的纬度、经度、水平精度和高度。但是这个方法没有被调用,-(void)locationManager:(CLLocationManager*)managedidUpdateToLocation:(CLLocation*)newLocationfromLocation:(CLLocation*)oldLocation;我的代码,////CDViewController.m//Compass////CreatedbyNaveenKumaron09/04/14.//Copyright(c)2014CamDon.Allrightsreserved.//#import"CDVi