在iPhone模拟器测试GPS问题

在iPhone模拟器测试GPS问题

本文介绍了在iPhone模拟器测试GPS问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一些关于在iPhone模拟器中测试GPS(核心位置)的文章。
这看起来很简单,但我无法让它工作。



我收到的错误讯息是:

$ $ p $

它不应该是 [[CLLocation alloc] init ...]; 而不是 [[CLLocation init] init ...]; ?


I found some various articles about testing the GPS (corelocation) in the iPhone simulator.It seems pretty straightforward, but i can't get it to work.

The error message i'am getting is:

2010-07-30 11:20:16.372 appname[50954:207] *** +[CLLocation initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:]: unrecognized selector sent to class 0x32081320

2010-07-30 11:20:16.373 appname[50954:207] CoreAnimation: ignoring exception: *** +[CLLocation initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:]: unrecognized selector sent to class 0x32081320

the code i'am using is:

self.locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;
locationManager.distanceFilter = 100.0f;
locationManager.desiredAccuracy= kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];

// test simulator location once
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updateTestLocation) userInfo:nil repeats:NO];


-(void)updateTestLocation{

CLLocationCoordinate2D newlocation;
newlocation.latitude = 37.0;
newlocation.longitude = 127.0;

CLLocation *sampleLocationUpdate = [[CLLocation init] initWithCoordinate:newlocation altitude:100 horizontalAccuracy:100 verticalAccuracy:100 timestamp:[NSDate date]];

[self locationManager:nil didUpdateToLocation: sampleLocationUpdate fromLocation: nil];
//[self locationManager:locationManager didUpdateToLocation: sampleLocationUpdate fromLocation: nil];

i hope someone can help me fix this, because it sure will save a lot of time testing

解决方案

Shouldn't it be [[CLLocation alloc] init...]; and not [[CLLocation init] init...];?

这篇关于在iPhone模拟器测试GPS问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:30