- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试使用 iOS 5 中新的 CLLocationManager API 来使用(转发)地理编码,但运气不佳。
我正在根据当前位置指定一个区域,但它会给我世界另一端的结果。
//CLLocation *currentloc is set to the current location when I get in here (<+37.78583400,-122.40641700>)
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:[currentloc coordinate] radius:5000 /*meters*/ identifier:@"You are here"];
// Region is now: (identifier You are here) <+37.78583400,-122.40641700> radius 5000.00m
NSString *addressString = @"Citibank"; //for example
[geoCoder geocodeAddressString:addressString inRegion:region completionHandler:^(NSArray* placemarks, NSError* error){
for (CLPlacemark* aPlacemark in placemarks)
{ // Process the placemark.
NSLog(@"Got Placemark : %@", aPlacemark);
}
}];
我得到的是:
> 2011-12-14 15:50:49.882 [12377:12503] Got Placemark : Citibank, New
> Delhi, Delhi, India @ <+28.63470640,+77.22010140> +/- 100.00m, region
> (identifier <+28.63517750,+77.21878050> radius 154.35)
> <+28.63517750,+77.21878050> radius 154.35m
>
> 2011-12-14 15:50:49.883[12377:12503] Got Placemark : CitiBank, Noida,
> Uttar Pradesh, India @ <+28.58157180,+77.32408380> +/- 100.00m, region
> (identifier <+28.58161950,+77.32315050> radius 154.41)
> <+28.58161950,+77.32315050> radius 154.41m
>
> 2011-12-14 15:50:49.885 [12377:12503] Got Placemark : Citibank, New
> Delhi, Delhi, India @ <+28.53627320,+77.21128390> +/- 100.00m, region
> (identifier <+28.53630050,+77.21054050> radius 154.46)
> <+28.53630050,+77.21054050> radius 154.46m
>
> ...
任何想法:
它认为我在新德里吗? (我认为答案是否定的 - 因为搜索具有相同 inRegion 的“All Star Donuts”会将我带到泰国
我是不是误用了“inRegion”
这对任何人都有效吗?因为当它发生时会很棒
最佳答案
好的,答案。
<醇>不,不是。它只是使用区域作为首先搜索的地方。来自 API:
Specifying a region lets you prioritize the returned set of results to locations that are close to some specific geographical area, which is typically the user’s current location.
一切正常。
Got Placemark : Starbuck Dr, Sausalito CA 94965, United States @ <+37.86315000,-122.57986000> +/- 100.00m, region (identifier <+37.86315000,-122.57986000> radius 282.92) <+37.86315000,-122.57986000> radius 282.92m
我的建议是检查从服务器返回的您所在地区的中心和地标中心之间的距离。
关于iphone - CLLocationManager 地理编码地址字符串 :inRegion not working to constrain region (ios5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8513623/
我在主线程上调用 -[CLLocationManager requestWhenInUseAuthorization]。我已经设置了我的委托(delegate),并在 info.plist 中为 NS
这是我的代码,显示 map 上当前位置的警报和蓝点: MapName.h #import #import #import @interface MapName : UIViewControlle
我怎样才能不出错地执行以下操作? locationManager.delegate = self 行表示它不能 Cannot assign value of type '(APPLocationMan
我需要一直跟踪用户位置(但不要耗尽电池电量)。 我了解在应用程序终止后获取更新的唯一方法是使用 startMonitoringSignificantLocationChanges。 来自苹果关于 st
在我的标题中放置 CLLocationManager *locationManager; @property (nonatomic, retain) CLLocationManager *locati
我正在按照几个教程中的描述实现 CLLocationManager。 一切工作正常,直到 LocationManager 收到第二次更新。然后就会发生内存泄漏。 Instruments 告诉我,泄漏的
我正在尝试获取 iOS 设备(特别是我的 iPhone)上的当前位置。 我正在使用this苹果的例子。 调用 stopUpdatingLocations 之前的超时时间是 60 秒。 当我将desir
是否可以在后台“挂起” cllocationmanager? 我试图停止管理器,然后在特定时间在后台重新启动它。这可能吗?我尝试停止管理器并启动 nstimer,但它不起作用,因为 nstimer 不
如果我有一个选项卡栏应用程序,并计划在不同的选项卡中使用核心位置,是否有一个好的通用位置来放置用于分配/初始化 CLLocationManager 的代码,并在调用 startUpdatingLoca
我有一个 Mac 应用程序,想要使用核心位置,但是,当我没有使用 wifi 但使用以太网电缆连接时,核心位置 (CLLocationManager) 报告操作无法完成。 确切的错误消息是 The op
我正在开发一个跟踪应用程序,它需要在 map 上显示跟踪路径。当我开始更新位置并且安装后没有移动设备时,locationManagar报告错误的位置更新, 我正在根据报告的位置点绘制路线, 另外当用户
从iOS9开始,我们在CCLocationManager中遇到了一些奇怪的问题。 iOS 7-8没有问题。怪异的位置会导致应用程序出错。该应用程序在开车时使用,我们有大约50位TestFlight测试
我正在使用 CLLocationManager要访问用户位置,以下委托(delegate)方法返回不准确的坐标 -(void)locationManager:(CLLocationManager *)
我的应用程序中有一个映射功能。它属于选项卡栏 Controller 选项卡之一。 我遇到的问题是该应用程序在启动后立即要求位置权限。 在用户真正进入应用程序的 map 部分之前,我不想用与位置相关的问
我有一个 iOS 应用程序,它是一个选项卡式应用程序,带有 3 个 View Controller ,所有这些都需要知道手机何时进入特定地理区域。 我们监控的区域是在运行时通过 Web 界面提供的,因
当我尝试尝试 LBS 应用程序时,我遇到了问题。在模拟器中测试时,它似乎工作。然后,我在 iPhone 上试了一下。它没有按预期工作。 当我启动应用程序时,它显示了我的位置纬度、经度、距离等所有信息。
我有两个不同的类,其中之一是 LocationService,仅用于确定位置。问题是我不知道为什么它不更新坐标变量。 View Controller : import UIKit class View
我是 swift 新手 - 目前,当我第一次通过 override func awakeFromNib() 在 init 上调用 setupLocationManager() 时,我的当前位置仅在控制
我正在阅读 application:didFinishLaunchingWithOptions:方法并从 NSHipster 中发现以下代码: @import CoreLocation; @inter
位置管理器使用辅助 GPS 来确定用户的位置,使用来自 wifi 和蜂窝适配器的信息来提高返回位置的准确性和电池效率。但是,该文档没有明确说明为此使用 wifi/手机信号信息是否涉及任何可能消耗用户手
我是一名优秀的程序员,十分优秀!