以下はビーコンを検出している私のコードですが、バックグラウンドでは通知を送信しません。私は、デバイスのスタックトレースを見ると 誰もが正確にコードESTBeaconManagerを使用したBeacon iOSからのバックグラウンド通知
@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];}
に問題が何であるかを追跡することができます私はこのメッセージが表示されます。
「-iPhone ESTBeacon [1366]:monitoringDidFailForRegion不十分な場所のサービスの承認。適切な許可が付与されるまで監視は中断されます。私はあなたのアプリケーションは、場所の権限を付与されていない疑いがある情報のplist
:あなたのplistのエントリに加えて、あなたはこのようなものが必要? –