Das Folgende ist mein Code, der das Beacon erkennt, aber im Hintergrund sendet es keine Benachrichtigung. Kann jemand verfolgen, was genau das Problem mit dem Code istHintergrund Benachrichtigung von Beacon iOS mit ESTBeaconManager
@property (nonatomic) ESTBeaconManager *beaconManager;
@property (strong, nonatomic) CLBeaconRegion *beacRegion;
@property (strong, nonatomic) NSArray *estimoteBeacons;
- (void)viewDidLoad {
self.beaconManager = [ESTBeaconManager new];
self.beaconManager.delegate = self;
self.beaconManager.returnAllRangedBeaconsAtOnce = YES;
self.beacRegion = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"xxxxxx-xxxx-xxxx-xxxx-..."] major:000 minor:0000 identifier:[NSString stringWithFormat:@"%@", @"HEY GUYS!"]];
[self.beaconManager startRangingBeaconsInRegion:self.beacRegion];
[self.beaconManager startMonitoringForRegion:self.beacRegion];
}
- (void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region
{
NSLog(@"didEnterRegion");
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = @"You have entered the region you are monitoring";
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotification];}
- (void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region
{
NSLog(@"didEnterRegion");
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = @"You have left the region you are monitoring";
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotification];}
ich diese Nachricht erhalten, wenn ich den Stack-Trace-Gerät finden Sie unter:
„-iPhone ESTBeacon [1366]: monitoringDidFailForRegion Unzureichende Location Services Genehmigung. Die Überwachung wird angehalten, bis die entsprechende Genehmigung erteilt wird. "
Obwohl ich requestWhenInUseAuthorization in info plist
verwenden Sie IBeacon oder eddystore konfiguriert? –