现在我正在使用proximitykit.framework来进行地理围栏。 我发现了这个示例:https://github.com/RadiusNetworks/proximity-kit-ios-example我得到了这个错误:“ProximityKit [错误]测距信标因错误而失败:错误域= kCLErrorDomain Code = 17”操作无法完成。 (kCLErrorDomain错误17.)“我也尝试在我的iPhone4中构建这个应用程序,但这个应用程序会自动退出。
这是我使用的方法:
- (void)proximityKitDidSync:(PKManager *)manager {
NSLog(@"Did Sync");
}
- (void)proximityKit:(PKManager *)manager didEnter:(PKRegion*)region {
NSLog(@"Entered Region %@ (%@)", region.name, region.identifier);
}
- (void)proximityKit:(PKManager *)manager didExit:(PKRegion *)region {
NSLog(@"Exited Region %@ (%@)", region.name, region.identifier);
}
- (void)proximityKit:(PKManager *)manager didRangeBeacons:(NSArray *)ibeacons inRegion: (PKIBeacon *)region
{
for (PKIBeacon *ibeacon in ibeacons) {
NSLog(@"Ranged UUID: %@ Major:%ld Minor:%ld RSSI:%ld", [ibeacon.uuid UUIDString], (long)ibeacon.major, (long)ibeacon.minor, (long)ibeacon.rssi);
}
}
- (void)proximityKit:(PKManager *)manager didDetermineState:(PKRegionState)state forRegion:(PKRegion *)region
{
if (state == PKRegionStateInside) {
NSLog(@"State Changed: inside region %@ (%@)", region.name, region.identifier);
} else if (state == PKRegionStateOutside) {
NSLog(@"State Changed: outside region %@ (%@)", region.name, region.identifier);
} else if (state == PKRegionStateUnknown) {
NSLog(@"State Changed: unknown region %@ (%@)", region.name, region.identifier);
}
}
- (void)proximityKit:(PKManager *)manager didFailWithError:(NSError *)error{
NSLog(@"The Error: %@", error.description);
}
- (void) alert:(NSString *)format, ...
{
va_list args;
va_start(args, format);
NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
va_end(args);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Proximity Kit"
message: [NSString stringWithFormat:@"%@", str]
delegate: nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
}
答案 0 :(得分:3)
Beacon Ranging需要蓝牙低功耗支持。在iPhone 4S或iPad第3代之前,iOS模拟器或物理设备上不提供此功能。