邻近套件:错误域=kCLErrorDomain Code=17



现在我正在使用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];
}

信标测距需要蓝牙低功耗支持。这在iOS模拟器或iPhone 4S或iPad第三代之前的物理设备上不可用。

相关内容

  • 没有找到相关文章

最新更新