Notification action button

318 Views Asked by At

I create UILocalNotification and UIMutableUserNotificationAction

if I use iphone, this action button it seems BUT I use ipad this action button does not seems

UIMutableUserNotificationAction *action = [[UIMutableUserNotificationAction alloc]init];
    action.identifier = @"ActionNotification";
    action.title = @"START";
    action.activationMode = UIUserNotificationActivationModeForeground;



    UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategory alloc]init];
    categorys.identifier = @"alert";
    [categorys setActions:@[action] forContext:UIUserNotificationActionContextMinimal];


    UIUserNotificationSettings *setings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:[NSSet setWithObjects:categorys, nil]];


    [[UIApplication sharedApplication] registerForRemoteNotifications];
    [[UIApplication sharedApplication] registerUserNotificationSettings:setings];



    UILocalNotification *localNotification = [[UILocalNotification alloc] init];

    localNotification.fireDate = aIntervalDate;
    //localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:5];
    localNotification.alertBody =@"Notification Test";
    localNotification.alertAction=@"START";
    localNotification.category=@"alert";
    localNotification.soundName = @"Reminder_Sound.mp3";
    localNotification.applicationIconBadgeNumber=1;
    // localNotification.hasAction=YES;
    NSDictionary *infoDict = @{@"title" : @"xxxxxx",
                               @"tipi" : @"yyyyy"};
    localNotification.userInfo = infoDict;
    localNotification.timeZone = [NSTimeZone systemTimeZone];
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
0

There are 0 best solutions below