iphone - iOS 7 Ranging beacons: Sometimes ranging is Unavailable, and the only solution is reboot the device -
i'm working beacons on ios 7.x, works fine when call startranging...
, device launch me error kclrangingunavailable, after check wifi disabled, restart bluetooth, , start , stop airplain mode, solution of problem reboot phone.
this sourcecode: @interface rbtmainviewcontroller () @property (nonatomic, retain) cllocationmanager* locationmanager; @end
@implementation rbtmainviewcontroller - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { _locationmanager=[[cllocationmanager alloc] init]; _locationmanager.delegate=self; nsuuid *estimoteuuid = [[nsuuid alloc] initwithuuidstring:@"00001111-2222-3333-4444-555566667777"]; clbeaconregion *region = [[clbeaconregion alloc] initwithproximityuuid:estimoteuuid identifier:@"proves range"]; if ([cllocationmanager ismonitoringavailableforclass:[clbeaconregion class]]) { [_locationmanager startmonitoringforregion:region]; [_locationmanager startrangingbeaconsinregion:region]; } else { nslog(@"this device not support monitoring beacon regions"); } } return self; } ... - (void)locationmanager:(cllocationmanager *)manager monitoringdidfailforregion:(clregion *)region witherror:(nserror *)error{ nslog(@"monitoringdidfailforrange: %@ witherror: %@", region, error); } - (void)locationmanager:(cllocationmanager *)manager rangingbeaconsdidfailforregion:(clbeaconregion *)region witherror:(nserror *)error{ nslog(@"rangingbeaconsdidfailforrange: %@ witherror: %@", region, error); } - (void)locationmanager:(cllocationmanager *)manager didstartmonitoringforregion:(clregion *)region{ nslog(@"monitoringstart: %@", region); } - (void)locationmanager:(cllocationmanager *)manager didrangebeacons:(nsarray *)beacons inregion:(clbeaconregion *)region{ nslog(@"rangingbeacons: %@ in (%@)", beacons, region); } @end
and ouput in iphone when errors happens:
2014-04-14 13:20:18.628 rangingbeaconstest[9042:60b] monitoringstart: clbeaconregion (identifier:'proves range', uuid:<__nsconcreteuuid 0x15554170> 00001111-2222-3333-4444-555566667777, major:(null), minor:(null)) 2014-04-14 13:20:23.752 rangingbeaconstest[9042:60b] rangingbeaconsdidfailforrange: clbeaconregion (identifier:'proves range', uuid:<__nsconcreteuuid 0x15565390> 00001111-2222-3333-4444-555566667777, major:(null), minor:(null)) witherror: error domain=kclerrordomain code=16 "the operation couldn’t completed. (kclerrordomain error 16.)"
this code error, unavailable ranging. can me problem?
thanks.
Comments
Post a Comment