【发布时间】:2014-11-23 15:49:52
【问题描述】:
这是代码 sn-p。下面。
// 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 中相同的应用程序。在没有授权请求的情况下工作。
分享你的经验。
【问题讨论】:
标签: ios objective-c ios7 core-location