我正在開發一個iOS應用程序,我正在使用信標。iBeacon和通知
我遇到了問題。我正處於開發階段,所以我只有我的appdelegate。在appdelegate.m我已經初始化,像這樣
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for 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 for a beacon");
[self.locationManager startRangingBeaconsInRegion:region];
} else {
NSLog(@"Device doesn't support beacons ranging");
}
return YES;
}
,然後我寫了兩個委託方法
- (void) locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
NSLog(@"EXIT");
}
- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(@"ENTER");
}
但他們從來沒有得到所謂!這裏有什麼問題?
你是對的。非常感謝! – dylaniato