Right now I am using proximitykit.framework to do geofencing. I found out this sample:https://github.com/RadiusNetworks/proximity-kit-ios-example and I got this error:"ProximityKit[Error] Ranging Beacons Failed with Error: Error Domain=kCLErrorDomain Code=17 "The operation couldn’t be completed. (kCLErrorDomain error 17.)" I also tried to build up this app in my iPhone4,but this app quit automatically.
here is the method I used:
- (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];
}
Beacon Ranging requires Bluetooth Low Energy support. This is not available on the iOS simulator or on a physical device prior to the iPhone 4S or iPad 3rd generation.