0

今日アプリケーションをテストしていたとき、didEnterRegion から発生した通知が以下のコードをトリガーできなかったことに気付きました.. (通知をアラート通知に設定しました)

UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notification)
{
//Set rootViewController.
}

ただし、通知スタイルをバナースタイルに変更したとき。上記のコードはトリガーされました

地域に入るコード:

-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{

[self sendLocalNotificationForReqgionConfirmationWithText:[NSString stringWithFormat:@"Check out %@ latest offer today!!", region.identifier]forBeaconRegion:(CLBeaconRegion *)region];}


-(void)sendLocalNotificationForReqgionConfirmationWithText:(NSString *)text forBeaconRegion: (CLBeaconRegion *)region {
NSNumber *testValue = [NSNumber numberWithInt:100];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = [NSDate dateWithTimeInterval:1.0 sinceDate:[NSDate date]];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"test";
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
localNotif.userInfo = @{@"Major": testValue };

[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[_locationManager startRangingBeaconsInRegion:region];}

それで、誰でもエラーが何であるかを教えてもらえますか? または、少なくとも何らかの方向性を示してください。御時間ありがとうございます。

4

0 に答える 0