我正在制作一个增强现实应用程序。
基本上我所拥有的是带有来自相机,雷达视图和屏幕上某些标记的图像的屏幕。
我正在使用CLLocationManager来获取我的标题和位置的更新。
我需要航向更新始终打开,因为雷达的旋转取决于它。我正在使用位置更新来获取我的位置,并基于此我正在寻找要显示的标记。
问题是,当我开机时iPhone在一段时间内(10 + - 分钟)过热了一点。我已经将精度设置为每100米,距离过滤器设置为100.
我应该设置一个计时器来停止并开始更新位置以防止过热(并且可能还会节省一些电池寿命)?有没有其他方法呢?
感谢您的建议。CLLocationManager过热iPhone
0
A
回答
1
这是一个非常好的时间,用户的“时间探查器”工具
locationController = [[MyCLController alloc] init];
locationController.delegate = self;
[locationController.locationManager startUpdatingLocation];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
showCurrentLocation = NO;
委派功能。我确定使用GPS对某些热量负责,但是您可以轻松地使用CPU或GPU过多的其他代码部分。
还有一个OpenGL的性能工具,我会看看,看看你是否可以找到任何太费税的零件。
另一种可能性是考虑使用AVFoundation获取相机图像,并查看是否可以为覆盖的视频图像指定较便宜的预览参数。
-1
- (id) init
{
self = [super init];
if (self != nil)
{
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
}
return self;
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"Location: %@", [newLocation description]);
[self.delegate locationUpdate:newLocation];
}
- (void)locationManager:(CLLocationManager *)managerdidFailWithError:(NSError *)error;
{
[self.delegate locationError:error];
NSLog(@"Error Error: %@",[error description]);
}
这些委托功能的B类MyCLConrolleer.m电话。
像这样在ViewController类中分配这个类。在视图控制器类
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[self getLocationNameWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude];
}
相关问题
- 1. iPhone CLLocationManager TrueHeading iPhoneSimulator
- 2. iPhone - 启动/停止CLLocationManager
- 3. iPhone开发 - CLLocationManager与MapKit
- 4. iPhone - CLLocationManager初始化返回无
- 5. iPhone CLLocationManager每0.5秒更新一次
- 6. 问题与CLLocationManager在iPhone模拟器
- 7. iPhone核心位置CLLocationManager更新率
- 8. CLLocationManager
- 9. - [CLLocationManager requestWhenInUseAuthorization]或 - [CLLocationManager requestAlwaysAuthorization]错误
- 10. 通过热
- 11. 用于iPhone的热图
- 12. CLLocationManager - kCLErrorDomain
- 13. CLLocationManager类
- 14. CLLocationManager位置更新通过WiFi?
- 15. iphone - 创建http服务器并通过热点连接
- 16. Cllocationmanager update oldlocation
- 17. CLLocationManager distanceFromLocation:returns -1
- 18. CLLocationManager trueHeading is -1
- 19. MKMapView和CLLocationManager
- 20. CLLocationManager和distanceFilter?
- 21. 停止CLLocationManager?
- 22. iOS 8 CLLocationManager
- 23. CLLocationManager onClientEventLocation,Zombie
- 24. CLLocationManager忽略stopUpdatingLocation
- 25. 如何CLLocationManager
- 26. iPhone/iPad上的Dreamweaver热点链接
- 27. iphone地图视图上的热图。
- 28. 为什么在iPhone SDK 4.0中未调用CLLocationManager委托?
- 29. iPhone - CLLocationManager在尝试获取当前位置时停止更新
- 30. CLLocationManager无法在iPhone模拟器上启动
它听起来像你在某种程度上过度CPU。我曾经有一款应用程序被诺基亚手机的CPU循环卡住,并且过热足以软化将屏幕粘在一起的胶水。确保您的应用程序不在“旋转循环”中,而应该在等待事件发生。 – 2012-03-07 01:29:37
@HotLicks我不认为这是不好的:),我的意思是它很温暖(iPhone并不真正加热,所以它很奇怪,我看到它温暖)在相机的右上角(可能是有核心位置也)。我会按照Kendall的建议检查时间分析器,看看会发生什么 – haluzak 2012-03-07 08:44:41