Tag: cllocationmanager

CLLocationmanager setAuthorizationStatus不起作用(越狱)

我有6.1.3 iOS越狱设备。 另外我有命令行工具,应该给我坐标。 关于位置的代码与普通的应用程序完美地工作,而不是在命令行中。 我发现类似的问题,但它似乎并没有工作: 获取GPS没有警戒查看与ROOT权限(越狱) – (void) start { NSLog(@"Started"); if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) { NSLog(@"%i", [CLLocationManager authorizationStatus]); } //[locationManager setAuthorizationStatus:YES forBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]]; [CLLocationManager setAuthorizationStatus:YES forBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]]; NSLog(@"%@", [[NSBundle mainBundle] bundleIdentifier]); NSLog(@"%@", [[NSBundle mainBundle] bundlePath]); if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) { NSLog(@"%i", [CLLocationManager authorizationStatus]); } [locationManager startUpdatingLocation]; } 所以它总是logging0作为授权状态= kCLAuthorizationStatusNotDetermined。 在构build完成之后,我还在ldid中添加了应用程序权利 […]

iOS 11 – 添加委托之后,未收到位置更新

我一直在使用“允许使用”和“始终允许”在iOS 11中的位置服务遇到问题。 工作没有问题在iOS <11.跟随这个线程试图修复,但仍然无法正常工作。 我错过了什么? 先谢谢你。 我有UITabViewController在我的应用程序和每个选项卡内的UINavigationController 。 我有一个单身的LocationManager类。 我将我的UINavigationController的RootViewController设置为委托ViewController的viewWillAppear来接收位置更新并在viewWillDisappear移除。 现在,当我启动应用程序,在创build标签栏之前,我可以看到LocationManager类中正在调用位置更新。 但是,当我添加我的UIViewController作为委托,并给startUpdatingLocation我没有收到位置更新在我的UIVIewController。 然后我按Homebutton并退出应用程序。 再次立即启动应用程序,我得到我的委托方法的位置更新。 我在Info.plist文件中添加了全部三个位置授权说明。 info.plist中: <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Blah Blah Blah</string> <key>NSLocationAlwaysUsageDescription</key> <string>Blah Blah Blah</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Blah Blah Blah</string> LocationController.m: #import "LocationController.h" //static int LOCATION_ACCESS_DENIED = 1; //static int LOCATION_NETWORK_ISSUE = 2; //static int LOCATION_UNKNOWN_ISSUE = 3; enum { LOCATION_ACCESS_DENIED = 1, LOCATION_NETWORK_ISSUE = 2, LOCATION_UNKNOWN_ISSUE […]

方法不从应用程序委托在iOS调用

我想从应用程序的其他地方调用一个方法来获取用户在应用程序委托中获得的位置。 当调用CLLocation *getCurLoc = [AppDelegate getCurrentLocation]; 从另一个视图控制器,没有返回。 应用程序代表是, @synthesize locationManager; CLLocation *location; – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ locationManager = [[CLLocationManager alloc]init]; locationManager.delegate = self; locationManager.desiredAccuracy=kCLLocationAccuracyKilometer; [locationManager startUpdatingLocation]; return YES; } – (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{ [locations lastObject]; [manager stopUpdatingLocation]; CLLocation *location = [locations lastObject]; } +(CLLocation *)getCurrentLocation{ return location; } 将其更改为带有“ – ”的实例方法不起作用。 应该把“位置”做成一个实例吗? 代表是否应该成为一个实例,还是有更好的方法从其他地方访问?

locationManager避免(null)string在一个标签

我有一些代码,find用户的位置,并将其返回到标签。 在某些情况下,subAdministrativeArea不可用或通道,我想修改我的string,所以它不显示(空)。 我尝试了一些如果检查这一点,但如果(空)不止一个是有问题的。 任何人都有这个想法? 这是我目前的代码,需要修改,以检测地标对象是否等于null: – (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocation *currentLocation = newLocation; [location stopUpdatingLocation]; [geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) { if (error == nil && [placemarks count] > 0) { placemark = [placemarks lastObject]; countryDetected = placemark.ISOcountryCode; placeLabel.text = [NSString stringWithFormat:@"%@, %@, %@, %@, %@ %@", placemark.country, placemark.subAdministrativeArea, placemark.subLocality, […]

Mapbox iOS8 Swift mapView.showUsersLocation

我试图使用Mapbox的iOS8 Swift cocoa插件mapbox和面临一个问题,当试图显示在mapView上的用户位置。 我的代码如下 func mapView(mapView: MGLMapView!, symbolNameForAnnotation annotation: MGLAnnotation!) -> String! { return "secondary_marker" } let manager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() let mapView = MGLMapView(frame: view.bounds, accessToken: "pk.privateMapboxAccessTokenGoesHere") mapView.autoresizingMask = .FlexibleWidth | .FlexibleHeight if CLLocationManager.authorizationStatus() == .NotDetermined { manager.requestAlwaysAuthorization() } mapView.showsUserLocation = true let x:MGLUserLocation = mapView.userLocation println(mapView.userLocation) println(x.coordinate.latitude) println(x.coordinate.longitude) … […]

什么是CoreLocation的区域监控系统定义的缓冲区?

我正在使用模拟器来testing区域监视。 在模拟器(debugging>位置>高速公路驱动器)中使用带有区域监视function的CoreLocation和高速公路驱动器testing位置path,我能够至less在视觉上模拟高速公路驱动器与各种叠加层相交的path。 只要我开始监视用户的位置,这些覆盖就会转换为区域并进行监视。 无论如何,这似乎没有工作得很好。 由我的覆盖表示的区域不会导致didEnter / didExit事件,当你“认为”他们会。 这些地区似乎比我指定的距离大得多。 我猜这是因为系统适用的缓冲。 苹果地区监测文件指出: 系统不会报告边界交叉点,直到超出边界加上系统定义的坐标距离。 这个缓冲值防止系统在用户行驶在边界附近时快速连续地产生许多进入和退出的事件。 文件似乎并没有说明这个坐垫是什么,确切地说。 也不是如何计算的。 有谁知道系统定义的坐垫是什么?

IOS 8 CLLocationManager问题(授权不工作)

#import "MyLocationViewController.h" #define NSLog(FORMAT, …) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]); @interface MyLocationViewController () @end @implementation MyLocationViewController { CLLocationManager *locationManager; } – (void)requestAlwaysAuthorization { [locationManager requestAlwaysAuthorization]; } – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.mapView.showsUserLocation = YES; self.mapView.delegate = self; locationManager = [[CLLocationManager alloc] init]; […]

检查系统时间是自动还是用户设置

我需要在当前项目中设置用户certificate的时间。 我发现了很多不同的问题,但没有一个似乎有我正在寻找的答案。 这些是我到目前为止所看到的问题: XCODE:如何从设备获取/validationACCURATE时间戳 是否有可能从iphone GPS获得primefaces钟时间戳? 我怎样才能在iPhone中获得实时,而不是用户在设置中设置的时间? 我有几个从服务器连接获取时间的选项,但是我也需要一个脱机解决scheme。 看起来,使用CLLocation获取的时间与设备时钟相同。 有没有拿到实际的GPS时间? 2.我知道系统时间设置不是公共API,因此不能改变。 是否有可能找出设备是否打开了自动时间设置? 如果自动时间是开的,那么我可以依赖系统时间来达到我的目的,如果没有,那就logging下来,这样我知道logging的时间是不可信的。

沿着上次更新的GPS坐标Swift iOS平滑移动和旋转GMSMarker

我正在使用GMSMapView 。 所以我添加了自定义的GMSMarker,并设置图像(例如Bike图像),并在用户开始移动时更改animation标记,并在locationManager中更改标记的angular度。 目前我只是更新GMSMarker的位置属性。 但它给了GMSMarker跳跃效应。 而不是这个,我想移动和 GMSMarker 顺利/正确地 旋转到GMSMapView。 我如何在Swift中实现这一点? 谢谢。 (void)updateLocationoordinates(CLLocationCoordinate2D) coordinates { if (marker == nil) { marker = [GMSMarker markerWithPosition:coordinates]; marker.icon = [UIImage imageNamed:IMAGE]; marker.map = mapView; } else{ marker.position = coordinates; } }

当飞行模式打开时,CLLocationManager如何获取一个位置

我的应用程序使用CLLocationManager从设备获取位置更新。 我曾假设,当设备在飞行模式下,我不会得到位置更新。 但是我愿意。 我之所以这样做,是因为苹果说飞行模式closures了Wifi,手机,蓝牙和GPS。 请参阅: http : //support.apple.com/kb/ht1355 那么,我是如何用一个看起来合理的坐标获取位置更新呢?