我是新来的iphone 通过使用CLLocation我可以找到经纬度,但它不工作在iphonesimulater4.0工作在3.2.1,请任何一个告诉我如何计算在iphone4.0纬度&经度。 在此先感谢如何在iphone4.0中查找经纬度?
回答
位置只显示在真实的设备上。您可能会发现CLLocationManager
中的值可以在模拟器中工作(可能来自您的交易所 - 虽然它不会非常准确),但地图上的蓝色指针始终位于CA!
谢谢,我可以得到默认的位置,但它不能在device4.0.how到iPhone设备4.0中的工作。 – sirisha 2011-05-16 11:37:38
您的应用是否被定位服务阻止?在iPhone上:设置 - >常规 - >位置服务 - >打开您的应用程序。 – 2011-05-16 11:56:30
另外,它可能是值得测试,您的设备GPS没有错误。打开地图应用程序并按位置按钮(左下角)。如果它发现你的位置,你知道你的手机是好的! – 2011-05-16 11:57:23
CLLocationCoordinate2D location =
[[[mapview userLocation] location] coordinate];
//NSLog(@"Location found from Map: %f %f",
location.latitude,location.longitude);
这个概念直接在你的应用代理中使用,并检查它的纬度和长度。
#pragma mark locationManager delegate
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
//if the time interval returned from core location is more than two minutes we ignore it because it might be from an old session
if(abs([newLocation.timestamp timeIntervalSinceDate: [NSDate date]]) < 120)
{
//CLLocation *test = [[CLLocation alloc] initWithLatitude:-33.857034 longitude:151.035929];
currentLocation = newLocation;
coordinates = newLocation.coordinate;
latitude = currentLocation.coordinate.latitude;
longitude = currentLocation.coordinate.longitude;
[locationManager stopUpdatingLocation];
}
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"%@", [error description]);
}
- 1. 如何查找纬度和经度
- 2. 查找经度和纬度
- 3. 如何在MapBox中查找标记的纬度/经度?
- 4. 如何使用纬度和经度在iPhone中查找地址?
- 5. 如何在xcode中查找mapview的经度和纬度?
- 6. 如何找到经度和纬度
- 7. 查找包含经度和纬度
- 8. 查找纬度/经度边框
- 9. 如何从iOS中的经度和纬度查找地址?
- 10. 如何查找node.js中的经度和纬度?
- 11. 找出经纬度
- 12. 如何在经纬度中嵌入经纬度网址
- 13. 如何找到纬度/经度/纬度点之间的距离?
- 14. 如何在经纬度android
- 15. 如何使用纬度和经度查找最近的商店?
- 16. 如何查找多个地址的经度和纬度
- 17. 如何查找我的Windows Phone 7.5的纬度和经度?
- 18. 如何查找距某点X距离的经度和纬度?
- 19. 如何查找GPS上的用户的经度和纬度
- 20. 如何从经度和纬度查找R和
- 21. 如何使用jVector地图插件查找纬度和经度
- 22. 如何查找特定位置的经度和纬度?
- 23. 如何使用google Api查找经度和纬度?
- 24. C# - 如何使用C#查找经度和纬度
- 25. 我如何找到经纬度
- 26. android经纬度位置查找器
- 27. 查找多个地址的经纬度
- 28. 从经纬度查找邮政编码
- 29. 检查图像中是否存在经度和纬度经度和纬度
- 30. 如何从城市名称中查找经纬度
在真实设备上测试,而不是在模拟器上测试。如果你的代码不起作用,你需要显示它。 – Eiko 2011-05-16 11:23:21