我使用CoreLocation在我的应用上发现了一个奇怪的行为.我正在使用区域监视功能,但在授权位置服务(通过弹出或设置 - >位置服务)后,区域监视失败(操作无法完成.kCLErrorDomain错误5.).如果我关闭应用程序并重新启动(因此已经授权),一切都按预期工作.我的代码看起来像这样:
-(void)initializeLocationServices
{
NSLog(@"Started location services");
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
locationManager.pausesLocationUpdatesAutomatically = NO;
[locationManager startUpdatingLocation]; // to show authorisation popup
}
-(CLCircularRegion*)createRegion
{
// Test coordinates
CLLocationDegrees latitude = 50;
CLLocationDegrees longitude = -1;
CLLocationDistance radius = 50; // meters;
// If radius is too large, registration fails automatically, so limit the radius to the maximum value
if (radius > locationManager.maximumRegionMonitoringDistance) {
radius = locationManager.maximumRegionMonitoringDistance;
}
CLCircularRegion* region …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,它在很大程度上依赖于监视可能在多个地区/区域中的用户访问.我目前正在尝试区域监控工作得很好,但是,位置回调并不像我想要的那样准确.我见过CLVisit,但那里的文档并没有很好地解释它,特别是它的使用.
我正在开发这样一个应用程序执行以下操作的项目:
viewController
按"开始"按钮转到下一个现在,我在这里监视一个区域,然后再监视另一个区域.所以数字实际上就是一个.但是我知道一个应用程序可以通过"区域监控"监控的区域的最大数量是15.现在我的问题是在这种情况下我应该处理这个最大数量的区域问题吗?如果是,那怎么样?
我想补充的另一件事是,它有一些解决方案,它只适用于iOS 6及更早版本.所以请根据用户在iOS7中的当前位置,通过"RegionMonitoring"监控处理"区域"数量的解决方案,让我知道.
如果能够给出答案或任何建议来完成我的应用程序所需要求,我将感到非常高兴.
我正在开发一个用户可以设置多个位置的应用程序.当用户使用GeoFencing进入或离开特定区域时,我成功显示通知.
现在,我需要为所有已保存的位置提供监控,而且可能需要数百个甚至更多.我已经阅读了给定的链接"您可以拥有多个活动地理围栏,每个设备用户的限制为100个."
有没有办法为每个设备用户添加100多个地理围栏?
谢谢!
我正在创建一个应用程序,告诉用户他们是否在目的地附近.我正在计算currentLocation
目的地之间的距离.我在里面做计算didUpdateLocations
.它正在工作但我已经看到有一些方法可以解决这个问题,而无需进行任何数学运算.
我正在注册该地区CLLocationManager
; 但似乎这些方法didExitRegion
并didEnterRegion
没有被调用.
以下是我注册区域的代码部分:
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
[self.locationManager startUpdatingLocation];
[self.mySearchBar resignFirstResponder];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
self.distToRemind = 0;
[worldMap removeAnnotations:[worldMap annotations]];
NSLog(@"executou de primeira");
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:[self.mySearchBar text] completionHandler:^(NSArray *placemarks, NSError *error)
{
CLPlacemark *placemark = [placemarks lastObject];
//test
//DefaultAnnotation *annot = [[DefaultAnnotation alloc] initWithCoordinate:placemark.location.coordinate andTitle:@""];
CLRegion *newRegion = [[CLRegion alloc] initCircularRegionWithCenter:placemark.location.coordinate radius:10.0 identifier:@"RegionBoundary"];
DefaultAnnotation *regionAnnotation = [[DefaultAnnotation alloc] initWithCoordinate:newRegion.center andTitle:@""];
[self identifyPlacemark:placemark andSetAnnotation:regionAnnotation];
MKCoordinateRegion …
Run Code Online (Sandbox Code Playgroud) core-location cllocationmanager ios clregion region-monitoring
我\xe2\x80\x99m 之前在使用 iOS 14.0 时遇到了以下问题 - 通过后台位置权限我可以:
\n使用 iOS14 重新测试,没有精确的位置,我的应用程序不再因应用程序切换器终止而被唤醒。
\n重新启用精确位置权限,一切都像以前一样。
\n在没有精确位置权限的情况下,我需要做什么才能让后台应用程序唤醒 iBeacon 区域?
\n或者
\n如何检测缺少精确位置权限并通知用户应用程序将无法按预期运行?
\n\ncllocationmanager ibeacon region-monitoring background-task ios14
我正在开发一个应用程序,用户可以在其中设置多个位置。当用户获得Enter或离开特定位置边界时,我成功显示通知。
现在,有些情况下我需要为所有保存的位置提供监视,并且可能有数百个甚至更多。我在Apple论坛上读过很多文章,其中许多iOS设备仅允许20个区域监视。
我已经开发了我的代码以超出这种情况。我已经设置locationManager.distanceFilter = 200; 当我获得位置更新时。首先,我已停止所有区域监视,并按最近位置的条件停止运行,然后再次启动20个已保存位置的区域监视。
我认为上述解决方案可能会导致在停止并再次重新启动区域监视时丢失任何已保存的位置。因此,请提供给我其他更好的解决方案,以解决仅20条有关“区域监视”问题的通知。
祝你今天愉快 。!!..
我知道iOS允许基于iBeacon的后台区域监控,但我找不到指示用户是否必须启用蓝牙的文档?
如果从控制中心禁用蓝牙,它仍然有效吗?如果用户禁用蓝牙,我觉得这几乎没用.
ios ×6
geofencing ×2
ibeacon ×2
mapkit ×2
android ×1
clregion ×1
ios14 ×1
ios7 ×1
objective-c ×1