我已经使用Core位置框架在我的IPOD中接收我的GPS坐标。第一次我可以获得纬度和经度,然后我收到错误消息,kCLErrorDomain Code = 0操作无法完成。
但是错误信息永远不会改变。我想第一次只有它起作用
#import "CoreLocationDemoViewController.h"
@implementation CoreLocationDemoViewController
@synthesize CLController;
- (void)viewDidLoad {
[super viewDidLoad];
CLController = [[CoreLocationController alloc] init];
CLController.delegate = self;
[CLController.locMgr startUpdatingLocation];
}
- (void)locationUpdate:(CLLocation *)location {
speedLabel.text = [NSString stringWithFormat:@"SPEED: %f", [location speed]];
latitudeLabel.text = [NSString stringWithFormat:@"LATITUDE: %f", location.coordinate.latitude];
longitudeLabel.text = [NSString stringWithFormat:@"LONGITUDE: %f", location.coordinate.longitude];
altitudeLabel.text = [NSString stringWithFormat:@"ALTITUDE: %f", [location altitude]];
errorLabel.text = @"";
}
- (void)locationError:(NSError *)error {
if(!CLController) //.text )
{
errorLabel.text = [error description];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
- (void)viewDidUnload {
}
- (void)dealloc {
[CLController release];
[super dealloc];
}
@end
任何人都知道有什么问题,非常感谢帮助。
谢谢, VKS
答案 0 :(得分:1)
是iPod没有GPS功能。在模拟器或iPhone中测试您的应用程序,而不是在iPod上。