0

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];
  • I'm not sure but it could be related because you're using an old framework. Since iOS 10, you **must** use the [`UNUserNotificaiton`](https://developer.apple.com/documentation/usernotifications) framework and use [`UNNotificationRequest`](https://developer.apple.com/documentation/usernotifications/unnotificationrequest). A good tutorial can be found [here](https://code.tutsplus.com/tutorials/an-introduction-to-the-usernotifications-framework--cms-27250) – mfaani Aug 24 '17 at 15:42
  • Also do you mean that that the notification works on iPhone but doens't work on iPad? your english isn't clear. Please clarify that. – mfaani Aug 24 '17 at 15:43
  • notification work iphone and ipad ,But notification action doenst work ipad – Kadir ALTINTOP Aug 25 '17 at 08:04
  • 1. does the iPad have notifications Allowed? 2.I recommend you to do delete the app on iPad and try again – mfaani Aug 25 '17 at 11:48
  • DONT FORGET TO USE THE NEWER FRAMEWORK – mfaani Aug 26 '17 at 10:24

0 Answers0