这是代码片段。如下所示。
// Initialize the region with the Estimote iBeacon manually generated UUID of 16 bytes size.
NSUUID *estimoteUUID = [[NSUUID alloc] initWithUUIDString:[Repository getiBeaconRegionUUID]];
_beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:estimoteUUID
identifier:@"A"];
// Launch app when display is turned on and inside region.
_beaconRegion.notifyEntryStateOnDisplay = YES;
// Create a location manager
_locationManager = [[CLLocationManager alloc] init];
// Set delegate
_locationManager.delegate = self;
if ([CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]])
{
[_locationManager requestAlwaysAuthorization];
[_locationManager startMonitoringForRegion:_beaconRegion];
// Get status update right away for UI
[_locationManager requestStateForRegion:_beaconRegion];
}
else
NSLog(@"This device does not support monitoring beacon regions");在应用程序中添加了NSLocationAlwaysUsageDescription。夹板。
从上面的键中从没有文本的对话框。
在设置=>隐私=>定位服务的应用程序。在第一个应用程序之后就被关闭了。跑。
委托方法
- (void)locationManager:(CLLocationManager *)manager
didDetermineState:(CLRegionState)state
forRegion:(CLRegion *)region 从来没有被召唤过。
在iOS 7中,同一个应用程序。在没有授权请求的情况下工作。
分享你的经验。
发布于 2014-09-30 15:41:30
在我将NSLocationAlwaysUsageDescription键值对添加到InfoPlist.strings之后,它显示了对话框并开始工作。
发布于 2014-09-29 09:54:47
当我从ios7迁移到ios8时,我也面临着同样的问题,我已经完成了对苹果文档的解释。
看看苹果在这里说了些什么:
在iOS 8中,NSLocationWhenInUseUsageDescription或Info.plist文件中的NSLocationAlwaysUsageDescription键值是required.but,您还需要在注册位置更新之前请求用户的权限,方法是根据需要调用[_locationManager requestWhenInUseAuthorization]或[_locationManager requestAlwaysAuthorization]。
请注意这一信息,它将有助于通过ios 8。
https://stackoverflow.com/questions/26096742
复制相似问题