ios - iBeacon and Notification -
i'm developing ios application , i'm using beacons.
i've problem. i'm @ beginning of development, have appdelegate. in appdelegate.m have initialized
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.locationmanager = [[cllocationmanager alloc] init]; self.locationmanager.delegate = self; nsuuid *uuid = [[nsuuid alloc] initwithuuidstring:@"8aefb031-6c32-486f-825b-e26fa193487d"]; clbeaconregion *region = [[clbeaconregion alloc] initwithproximityuuid:uuid identifier:@"region"]; if ([cllocationmanager ismonitoringavailableforclass:[clbeaconregion class]]) { nslog(@"i'm looking beacon"); [self.locationmanager startrangingbeaconsinregion:region]; } else { nslog(@"device doesn't support beacons ranging"); } return yes; }
and wrote 2 delegate methods
- (void) locationmanager:(cllocationmanager *)manager didexitregion:(clregion *)region { nslog(@"exit"); } - (void) locationmanager:(cllocationmanager *)manager didenterregion:(clregion *)region { nslog(@"enter"); }
but never called!!! what's problem here?
you range never monitor regions.
ranging beacons call:
locationmanager:didrangebeacons:inregion:
the methods enterregion/exitregion want monitoring only. call:
- (void)startmonitoringforregion:(clregion *)region
Comments
Post a Comment